You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by "Thomas Mueller (JIRA)" <ji...@apache.org> on 2012/07/16 16:46:35 UTC

[jira] [Created] (OAK-189) Swallowed exceptions

Thomas Mueller created OAK-189:
----------------------------------

             Summary: Swallowed exceptions
                 Key: OAK-189
                 URL: https://issues.apache.org/jira/browse/OAK-189
             Project: Jackrabbit Oak
          Issue Type: Bug
          Components: jcr
            Reporter: Thomas Mueller


Exceptions should not be silently swallowed. This is currently done in SessionDelegate$SessionNameMapper, methods getOakPrefix(), getOakPrefixFromURI(), and getJcrPrefix(). Those methods catch RepositoryException, don't log by default (only when using debug level), and don't log the exception stack trace or throw an exception.

Catching a very wide band of exceptions (RepositoryException) and then simply returning null is not an acceptable solution in my view.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OAK-189) Swallowed exceptions

Posted by "Michael Dürig (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OAK-189?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13421330#comment-13421330 ] 

Michael Dürig commented on OAK-189:
-----------------------------------

This is another example for why I think checked exceptions are not worth it. It forces exceptions to be handled in places where nothing can be done about them. So they are just ignored... 
                
> Swallowed exceptions
> --------------------
>
>                 Key: OAK-189
>                 URL: https://issues.apache.org/jira/browse/OAK-189
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: jcr
>            Reporter: Thomas Mueller
>
> Exceptions should not be silently swallowed. This is currently done in SessionDelegate$SessionNameMapper, methods getOakPrefix(), getOakPrefixFromURI(), and getJcrPrefix(). Those methods catch RepositoryException, don't log by default (only when using debug level), and don't log the exception stack trace or throw an exception.
> Catching a very wide band of exceptions (RepositoryException) and then simply returning null is not an acceptable solution in my view.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (OAK-189) Swallowed exceptions

Posted by "Thomas Mueller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OAK-189?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13422310#comment-13422310 ] 

Thomas Mueller commented on OAK-189:
------------------------------------

Well, this is not about checked versus uncheck exceptions, but about catching an exception and then simply "return null", without logging the exception, without re-throwing a different exception. The exception is silently ignored, and the code behaves in a different way.
                
> Swallowed exceptions
> --------------------
>
>                 Key: OAK-189
>                 URL: https://issues.apache.org/jira/browse/OAK-189
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: jcr
>            Reporter: Thomas Mueller
>
> Exceptions should not be silently swallowed. This is currently done in SessionDelegate$SessionNameMapper, methods getOakPrefix(), getOakPrefixFromURI(), and getJcrPrefix(). Those methods catch RepositoryException, don't log by default (only when using debug level), and don't log the exception stack trace or throw an exception.
> Catching a very wide band of exceptions (RepositoryException) and then simply returning null is not an acceptable solution in my view.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OAK-189) Swallowed exceptions

Posted by "Thomas Mueller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OAK-189?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13415201#comment-13415201 ] 

Thomas Mueller commented on OAK-189:
------------------------------------

The reason why I think it's not acceptable is that the exception could be anything, for example out of disk space, or some internal error. Just silently returning null, without logging, makes it hard to find the root cause of the problem, because everything else might just look fine. Some code might accept null as a correct answer, so that the program just behaves somewhat differently.
                
> Swallowed exceptions
> --------------------
>
>                 Key: OAK-189
>                 URL: https://issues.apache.org/jira/browse/OAK-189
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: jcr
>            Reporter: Thomas Mueller
>
> Exceptions should not be silently swallowed. This is currently done in SessionDelegate$SessionNameMapper, methods getOakPrefix(), getOakPrefixFromURI(), and getJcrPrefix(). Those methods catch RepositoryException, don't log by default (only when using debug level), and don't log the exception stack trace or throw an exception.
> Catching a very wide band of exceptions (RepositoryException) and then simply returning null is not an acceptable solution in my view.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira