Are you kidding me?!?!?! What a waste of an hour!
Man.. that is so lame.. whats worse is the contructor for JspException takes a cause, but assigns it to rootCause, and doesn't pass it to its parent class, so your left thinking your doing the right thing..grrr
Here is the code in my error.jsp to display the exception.
ByteArrayOutputStream ostr = new ByteArrayOutputStream();
exception.printStackTrace(new PrintStream(ostr));
out.print(ostr);
ostr.reset();
if( exception instanceof JspException ) {
Throwable rootCause = ((JspException)exception).getRootCause();
if( rootCause != null ) {
out.println("");
out.println("Root cause:");
rootCause.printStackTrace(new PrintStream(ostr));
out.print(ostr);
}
}
Here is a link to a more detailed solution (except it doesn't mention the above problem.
http://jroller.com/page/prpatel?anchor=handling_the_three_kinds_of
I filed a bug with Sun after searching and finding nothing related. We'll see how it goes...
Update: Well, this happens with ServletException, NamingException (and all its children), plus a slew of others.
Update: I submitted the bug to Sun. Here's my response so far :)
************************************************
Your report has been assigned an internal review ID of: 282419
This review ID is NOT visible on the "Java Developer Connection" (JDC).
[...]
<< Home