Propage exception causes while throwing ServletException
--------------------------------------------------------

         Key: BEEHIVE-1007
         URL: http://issues.apache.org/jira/browse/BEEHIVE-1007
     Project: Beehive
        Type: Bug
  Components: NetUI  
    Reporter: Subbu Allamaraju


I have come across a usage of ServletException that drops out the original 
cause of the exception. 

PageFlowPageFilter.runPage methods has code snippet that looks like

catch(Something s) {
    throw new ServletException(s);
}

Since ServletException is pre-J2SE1.4, its constructor does not call 
super(cause), thereby losing exception chaining.  For all pre-J2SE1.4 exception 
classes in J2EE, we need to initialize the cause explicitly via initCause().

To get exception chaining correctly, this code should be changed to

catch(Something s) {
    ServletException se = new ServletException(s);
    s.initCause(s);
    throw se;
}

I'm not sure if there are other places in netui throwing similar exceptions. It 
would be good do a grep on the source.

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

Reply via email to