You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by fu...@apache.org on 2003/06/21 19:37:17 UTC
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves ErrorReportValve.java
funkman 2003/06/21 10:37:17
Modified: catalina/src/share/org/apache/catalina/valves
ErrorReportValve.java
Log:
Dig as deep as possible to display possible nesting of ServletExceptions
Revision Changes Path
1.4 +16 -10 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves/ErrorReportValve.java
Index: ErrorReportValve.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves/ErrorReportValve.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ErrorReportValve.java 9 Oct 2002 12:42:51 -0000 1.3
+++ ErrorReportValve.java 21 Jun 2003 17:37:17 -0000 1.4
@@ -99,7 +99,7 @@
*
* <p>This Valve should be attached at the Host level, although it will work
* if attached to a Context.</p>
- *
+ *
* <p>HTML code from the Cocoon 2 project.</p>
*
* @author Remy Maucherat
@@ -153,7 +153,7 @@
/**
- * Invoke the next Valve in the sequence. When the invoke returns, check
+ * Invoke the next Valve in the sequence. When the invoke returns, check
* the response state, and output an error report is necessary.
*
* @param request The servlet request to be processed
@@ -172,7 +172,7 @@
context.invokeNext(request, response);
ServletRequest sreq = (ServletRequest) request;
- Throwable throwable =
+ Throwable throwable =
(Throwable) sreq.getAttribute(Globals.EXCEPTION_ATTR);
ServletResponse sresp = (ServletResponse) response;
@@ -228,7 +228,7 @@
/**
* Prints out an error report.
- *
+ *
* @param request The request being processed
* @param response The response being generated
* @param exception The exception that occurred (which possibly wraps
@@ -326,7 +326,7 @@
sb.append("</b> <pre>");
sb.append(stackTrace.toString());
sb.append("</pre></p>");
- if (rootCause != null) {
+ while (rootCause != null) {
stackTrace = new StringWriter();
rootCause.printStackTrace(new PrintWriter(stackTrace));
sb.append("<p><b>");
@@ -334,6 +334,12 @@
sb.append("</b> <pre>");
sb.append(stackTrace.toString());
sb.append("</pre></p>");
+
+ /* In case root cause is somehow heavily nested */
+ if (rootCause instanceof ServletException)
+ rootCause = ((ServletException) rootCause).getRootCause();
+ else
+ rootCause = null;
}
}
@@ -346,7 +352,7 @@
Writer writer = response.getReporter();
if (writer != null) {
-
+
Locale locale = Locale.getDefault();
try {
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org