[ 
https://issues.apache.org/jira/browse/LANG-967?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13947255#comment-13947255
 ] 

Sebb commented on LANG-967:
---------------------------

The point was not to encourage people to catch Throwable or Error, but to 
provide a standardised way to handle them if the code really needs to do so.

The sample usage is a bit too simplistic; in most cases the code would need to 
log or otherwise deal with the Throwable.
The proposed method is used to handle out those Throwables that must be 
rethrown before the code does whatever it needs to do.

> Code should never catch and ignore all Throwables
> -------------------------------------------------
>
>                 Key: LANG-967
>                 URL: https://issues.apache.org/jira/browse/LANG-967
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Sebb
>             Fix For: Patch Needed
>
>
> Code should never catch and ignore all Throwables - ThreadDeath and 
> VirtualMachineError must be rethrown.
> It would be useful to provide a method to enforce this behaviour.
> For example,. as is done by the Tomcat method \[1] with source here \[2]
> Sample usage:
> {code}
> try {
>     reader.close();
> } catch (Throwable u) {
>     ExceptionUtils.handleThrowable(u);
> }
> {code}
> \[1] org.apache.tomcat.util.ExceptionUtils#handleThrowable()
> \[2] 
> https://svn.apache.org/repos/asf/tomcat/trunk/java/org/apache/tomcat/util/ExceptionUtils.java



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to