You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2007/01/29 02:45:07 UTC
svn commit: r500918 - in /tomcat/tc6.0.x/trunk:
java/org/apache/catalina/core/StandardWrapper.java
java/org/apache/catalina/valves/ErrorReportValve.java
webapps/docs/changelog.xml
Author: markt
Date: Sun Jan 28 17:45:06 2007
New Revision: 500918
URL: http://svn.apache.org/viewvc?view=rev&rev=500918
Log:
Revert port of 39088 as per discussion on dev list.
Modified:
tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardWrapper.java
tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/ErrorReportValve.java
tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml
Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardWrapper.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardWrapper.java?view=diff&rev=500918&r1=500917&r2=500918
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardWrapper.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardWrapper.java Sun Jan 28 17:45:06 2007
@@ -31,8 +31,6 @@
import java.security.AccessController;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
-import java.sql.SQLException;
-
import javax.servlet.Servlet;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
@@ -293,7 +291,7 @@
*/
protected static Properties restrictedServlets = null;
-
+
// ------------------------------------------------------------- Properties
@@ -677,35 +675,18 @@
* @param e The servlet exception
*/
public static Throwable getRootCause(ServletException e) {
- Throwable rootCause = e.getRootCause();
- return findRootCause(e, rootCause);
+ Throwable rootCause = e;
+ Throwable rootCauseCheck = null;
+ // Extra aggressive rootCause finding
+ int loops = 0;
+ do {
+ loops++;
+ rootCauseCheck = rootCause.getCause();
+ if (rootCauseCheck != null)
+ rootCause = rootCauseCheck;
+ } while (rootCauseCheck != null && (loops < 20));
+ return rootCause;
}
-
-
- /*
- * Work through the root causes using specific methods for well known types
- * and getCause() for the rest. Stop when the next rootCause is null or
- * an exception is found that has itself as its own rootCause.
- */
- private static final Throwable findRootCause(Throwable theException,
- Throwable theRootCause) {
-
- Throwable deeperRootCause = null;
-
- if (theRootCause == null || theRootCause == theException) {
- return theException;
- }
-
- if (theRootCause instanceof SQLException) {
- deeperRootCause = ((SQLException) theRootCause).getNextException();
- }
- if (deeperRootCause == null) {
- deeperRootCause = theRootCause.getCause();
- }
-
- return findRootCause(theRootCause, deeperRootCause);
- }
-
/**
Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/ErrorReportValve.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/ErrorReportValve.java?view=diff&rev=500918&r1=500917&r2=500918
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/ErrorReportValve.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/ErrorReportValve.java Sun Jan 28 17:45:06 2007
@@ -21,7 +21,6 @@
import java.io.IOException;
import java.io.Writer;
-import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
@@ -217,9 +216,9 @@
sb.append(RequestUtil.filter(stackTrace));
sb.append("</pre></p>");
+ int loops = 0;
Throwable rootCause = throwable.getCause();
- Throwable nestedRootCause = null;
- while (rootCause != null) {
+ while (rootCause != null && (loops < 10)) {
stackTrace = getPartialServletStackTrace(rootCause);
sb.append("<p><b>");
sb.append(sm.getString("errorReportValve.rootCause"));
@@ -227,25 +226,10 @@
sb.append(RequestUtil.filter(stackTrace));
sb.append("</pre></p>");
// In case root cause is somehow heavily nested
- try {
- if (rootCause instanceof SQLException) {
- nestedRootCause = ((SQLException) rootCause).
- getNextException();
- }
- if (nestedRootCause == null) {
- nestedRootCause = rootCause.getCause();
- }
-
- if (rootCause == nestedRootCause)
- rootCause = null;
- else {
- rootCause = nestedRootCause;
- nestedRootCause = null;
- }
- } catch (ClassCastException e) {
- rootCause = null;
- }
+ rootCause = rootCause.getCause();
+ loops++;
}
+
sb.append("<p><b>");
sb.append(sm.getString("errorReportValve.note"));
sb.append("</b> <u>");
Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?view=diff&rev=500918&r1=500917&r2=500918
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Sun Jan 28 17:45:06 2007
@@ -31,10 +31,6 @@
web.xml. (markt)
</fix>
<fix>
- <bug>39088</bug>: Port fix from TC5 that improved chances of finding
- the true root cause. (markt)
- </fix>
- <fix>
<bug>41217</bug>: Set secure attribute on SSO cookie when cookie is
created during a secure request. Patch provided by Chris Halstead.
(markt)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org