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

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

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View in Thread

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.

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