I guess one could do this:
Create instance variable called JspException which is initialized to
protected jspExceptionClazz =
Class.forName("javax.servlet.jsp.JspException");
Then findRootCause could be this (missing the exception checking) - in
this version theRootCause is unneeded but can be kept for binary compat.
Sorry for the line wraps
private static final Throwable findRootCause(Throwable theException,
Throwable theRootCause) {
while (theException!=null) {
Throwable deeperRootCause = null;
if (theException == theException) {
return theException;
} else if (theException instanceof ServletException) {
deeperRootCause = ((ServletException) theException).getRootCause();
} else if (jspExceptionClazz!=null &&
jspExceptionClazz.isAssignableFrom(theException)) {
deeperRootCause =
(Throwable)IntrospectionUtils.getProperty(rootCause, "rootCause");
}
if (deeperRootCause==null) {
return theException;
}
if (theException == deeperRootCause) {
return theException;
}
theException = deeperRootCause;
}
// In case theException was null in the first place
return theException;
}
-Tim
Mark Thomas wrote:
Tim Funk wrote:
Does this introduces a new dependency on the jsp-api - which could be a
regression for people who embed tomcat without using jsp's.
Yes, it does add an additional dependency. I didn't consider the
embedded use case.
Also the checking is not that aggressive any more in the case of nested
exceptions. This may leave the root cause still unexposed.
My bad. I missed the recursion part of the patch.
This patch seems better:
http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/valves/ErrorReportValve.java?r1=466608&r2=496117&diff_format=h
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]