[jboss-jira] [JBoss JIRA] Commented: (JBREM-1183) ServerThread should catch java.lang.Error

David Lloyd (JIRA) jira-events at lists.jboss.org
Mon Feb 8 10:45:27 EST 2010


    [ https://jira.jboss.org/jira/browse/JBREM-1183?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12511012#action_12511012 ] 

David Lloyd commented on JBREM-1183:
------------------------------------

The safest way to ensure that a resource is reclaimed in the event of an exception is to use something like this:

boolean ok = false;
try {
    ...do sensitive operations...
    ok = true;
} finally {
    if (! ok) {
        safeClose(resource);
    }
}

where "safeClose" is a method which surrounds the appropriate cleanup task (close in this case) with a try/catch (Throwable t) which logs t (it's never a good idea to allow exceptions to be propagated from a finally block).

> ServerThread should catch java.lang.Error
> -----------------------------------------
>
>                 Key: JBREM-1183
>                 URL: https://jira.jboss.org/jira/browse/JBREM-1183
>             Project: JBoss Remoting
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>    Affects Versions: 2.2.3.SP1, 2.5.2.SP2 (Flounder)
>            Reporter: Ron Sigal
>            Assignee: Ron Sigal
>             Fix For: 2.5.2.SP3 (Flounder)
>
>
> org.jboss.remoting.transport.socket.ServerThread.dorun() does not catch org.lang.Error, so an Error causes it to terminate without closing its socket.  

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list