From: remm String
* specifying the text of
* the exception message
- *
*/
-
public ServletException(String message) {
- super(message);
+ super(message);
}
-
-
-
-
/**
* Constructs a new servlet exception when the servlet
@@ -73,7 +52,6 @@ public class ServletException extends Exception {
* about the "root cause" exception that interfered with its
* normal operation, including a description message.
*
- *
* @param message a String containing
* the text of the exception message
*
@@ -81,18 +59,11 @@ public class ServletException extends Exception {
* that interfered with the servlet's
* normal operation, making this servlet
* exception necessary
- *
*/
-
public ServletException(String message, Throwable rootCause) {
- super(message);
- this.rootCause = rootCause;
+ super(message, rootCause);
}
-
-
-
-
/**
* Constructs a new servlet exception when the servlet
* needs to throw an exception and include a message
@@ -110,33 +81,18 @@ public class ServletException extends Exception {
* that interfered with the servlet's
* normal operation, making the servlet exception
* necessary
- *
*/
-
public ServletException(Throwable rootCause) {
- super(rootCause.getLocalizedMessage());
- this.rootCause = rootCause;
+ this(rootCause.getLocalizedMessage(), rootCause);
}
-
-
-
-
-
+
/**
* Returns the exception that caused this servlet exception.
*
- *
* @return the Throwable
* that caused this servlet exception
- *
*/
-
public Throwable getRootCause() {
- return rootCause;
+ return getCause();
}
}
-
-
-
-
-
diff --git a/java/org/apache/catalina/core/StandardWrapper.java b/java/org/apache/catalina/core/StandardWrapper.java
index a08c22620..28e278cf2 100644
--- a/java/org/apache/catalina/core/StandardWrapper.java
+++ b/java/org/apache/catalina/core/StandardWrapper.java
@@ -679,17 +679,13 @@ public class StandardWrapper
Throwable rootCause = e;
Throwable rootCauseCheck = null;
// Extra aggressive rootCause finding
+ int loops = 0;
do {
- try {
- rootCauseCheck = (Throwable)IntrospectionUtils.getProperty
- (rootCause, "rootCause");
- if (rootCauseCheck!=null)
- rootCause = rootCauseCheck;
-
- } catch (ClassCastException ex) {
- rootCauseCheck = null;
- }
- } while (rootCauseCheck != null);
+ loops++;
+ rootCauseCheck = rootCause.getCause();
+ if (rootCauseCheck != null)
+ rootCause = rootCauseCheck;
+ } while (rootCauseCheck != null && (loops < 20));
return rootCause;
}
diff --git a/java/org/apache/catalina/valves/ErrorReportValve.java b/java/org/apache/catalina/valves/ErrorReportValve.java
index 29b60066c..0c8b3c574 100644
--- a/java/org/apache/catalina/valves/ErrorReportValve.java
+++ b/java/org/apache/catalina/valves/ErrorReportValve.java
@@ -227,7 +227,8 @@ public class ErrorReportValve
sb.append(RequestUtil.filter(stackTrace));
sb.append("
"); sb.append(sm.getString("errorReportValve.rootCause")); @@ -235,12 +236,8 @@ public class ErrorReportValve sb.append(RequestUtil.filter(stackTrace)); sb.append("
"); // In case root cause is somehow heavily nested - try { - rootCause = (Throwable)IntrospectionUtils.getProperty - (rootCause, "rootCause"); - } catch (ClassCastException e) { - rootCause = null; - } + rootCause = rootCause.getCause(); + loops++; } sb.append("");