Author: markt Date: Fri Jan 19 18:58:37 2007 New Revision: 498052 URL: http://svn.apache.org/viewvc?view=rev&rev=498052 Log: Revert this while I figure why the build broke
Modified: tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/StandardWrapper.java Modified: tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/StandardWrapper.java URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/StandardWrapper.java?view=diff&rev=498052&r1=498051&r2=498052 ============================================================================== --- tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/StandardWrapper.java (original) +++ tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/StandardWrapper.java Fri Jan 19 18:58:37 2007 @@ -28,8 +28,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; @@ -38,7 +36,6 @@ import javax.servlet.ServletResponse; import javax.servlet.SingleThreadModel; import javax.servlet.UnavailableException; -import javax.servlet.jsp.JspException; import javax.management.ListenerNotFoundException; import javax.management.MBeanNotificationInfo; import javax.management.Notification; @@ -59,6 +56,7 @@ import org.apache.catalina.security.SecurityUtil; import org.apache.catalina.util.Enumerator; import org.apache.catalina.util.InstanceSupport; +import org.apache.tomcat.util.IntrospectionUtils; import org.apache.tomcat.util.log.SystemLogHandler; import org.apache.commons.modeler.Registry; @@ -634,33 +632,23 @@ * @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 + do { + try { + rootCauseCheck = (Throwable)IntrospectionUtils.getProperty + (rootCause, "rootCause"); + if (rootCause == rootCauseCheck) + rootCauseCheck = null; + else if (rootCauseCheck != null) + rootCause = rootCauseCheck; - /* - * 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) { - deeperRootCause = theException; - } else if (theRootCause instanceof ServletException) { - deeperRootCause = ((ServletException) theRootCause).getRootCause(); - } else if (theRootCause instanceof JspException) { - deeperRootCause = ((JspException) theRootCause).getRootCause(); - } else if (theRootCause instanceof SQLException) { - deeperRootCause = ((SQLException) theRootCause).getNextException(); - } else { - deeperRootCause = theRootCause.getCause(); - } - - return deeperRootCause; + } catch (ClassCastException ex) { + rootCauseCheck = null; + } + } while (rootCauseCheck != null); + return rootCause; } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]