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.
Description
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.