You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Thomas Mueller (JIRA)" <ji...@apache.org> on 2008/05/13 14:50:55 UTC

[jira] Created: (JCR-1598) Problematic exception handling in Jackrabbit WebApp

Problematic exception handling in Jackrabbit WebApp
---------------------------------------------------

                 Key: JCR-1598
                 URL: https://issues.apache.org/jira/browse/JCR-1598
             Project: Jackrabbit
          Issue Type: Bug
          Components: jackrabbit-webapp
            Reporter: Thomas Mueller
            Priority: Minor


In this project, the cause of the exception is often ignored, and only the message of the cause is used, as in:

} catch (Exception e) {
    log.error("Error in configuration: {}", e.toString());
    throw new ServletException("Error in configuration: " + e.toString());
}

An additional problem is that when using ServletException(String message, Throwable rootCause), the rootCause is not used in printStackTrace(), that means the cause is not logged. See also: http://closingbraces.net/2007/11/27/servletexceptionrootcause/

It is therefore better to convert 
  throw new ServletException("Unable to create RMI repository. jcr-rmi.jar might be missing.", e);
to
  ServletException s = new ServletException("Unable to create RMI repository. jcr-rmi.jar might be missing.");
  s.initCause(e);
  throw s;






-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (JCR-1598) Problematic exception handling in Jackrabbit WebApp

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1598?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jukka Zitting resolved JCR-1598.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 1.5
         Assignee: Jukka Zitting

Good point. Added a ServletExceptionWithCause utility class and started using it in revision 691632.

Resolving as Fixed.

> Problematic exception handling in Jackrabbit WebApp
> ---------------------------------------------------
>
>                 Key: JCR-1598
>                 URL: https://issues.apache.org/jira/browse/JCR-1598
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jackrabbit-webapp
>            Reporter: Thomas Mueller
>            Assignee: Jukka Zitting
>            Priority: Minor
>             Fix For: 1.5
>
>
> In this project, the cause of the exception is often ignored, and only the message of the cause is used, as in:
> } catch (Exception e) {
>     log.error("Error in configuration: {}", e.toString());
>     throw new ServletException("Error in configuration: " + e.toString());
> }
> An additional problem is that when using ServletException(String message, Throwable rootCause), the rootCause is not used in printStackTrace(), that means the cause is not logged. See also: http://closingbraces.net/2007/11/27/servletexceptionrootcause/
> It is therefore better to convert 
>   throw new ServletException("Unable to create RMI repository. jcr-rmi.jar might be missing.", e);
> to
>   ServletException s = new ServletException("Unable to create RMI repository. jcr-rmi.jar might be missing.");
>   s.initCause(e);
>   throw s;

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.