Per Servlet 2.3, if a servlet throws a wrapped exception, the error handler 
that receives it gets the underlying root cause as the exception. That is, if 
ServletException(new TesterException()) is thrown, the exception in the 
request under attribute "javax.servlet.error.exception" will be 
TesterException, not ServletException.

The test in catalina/tester assumes that the root cause will still be wrapped 
in a ServletException.


With this patch, plus the others I've posted, the tomcat-5 passes all of the 
catalina tester tests. If anyone is interested, I can post a rolled up set of 
patches.


? conf
Index: tester/org/apache/tester/ErrorPage04.java
===================================================================
RCS file: /home/cvspublic/jakarta-tomcat-catalina/tester/src/tester/org/apache/tester/ErrorPage04.java,v
retrieving revision 1.1.1.1
diff -u -w -r1.1.1.1 ErrorPage04.java
--- tester/org/apache/tester/ErrorPage04.java	18 Jul 2002 16:47:26 -0000	1.1.1.1
+++ tester/org/apache/tester/ErrorPage04.java	23 Sep 2002 17:44:46 -0000
@@ -89,28 +89,19 @@
         value = request.getAttribute("javax.servlet.error.exception");
         if (value == null)
             sb.append(" exception is missing/");
-        else if (!(value instanceof javax.servlet.ServletException)) {
+        else if (!(value instanceof TesterException)) {
             sb.append(" exception class is ");
             sb.append(value.getClass().getName());
             sb.append("/");
         } else {
-            exception = (ServletException) value;
-            rootCause = exception.getRootCause();
-            if (rootCause == null) {
-                sb.append(" rootCause is missing/");
-            } else if (!(rootCause instanceof TesterException)) {
-                sb.append(" rootCause is ");
-                sb.append(rootCause.getClass().getName());
-                sb.append("/");
-            } else {
-                TesterException te = (TesterException) rootCause;
+            TesterException te = (TesterException) value;
                 if (!"ErrorPage03 Threw Exception".equals(te.getMessage())) {
                     sb.append(" exception message is ");
                     sb.append(te.getMessage());
                     sb.append("/");
                 }
             }
-        }
+        
 
         value = request.getAttribute("javax.servlet.error.exception_type");
         if (value == null)
@@ -121,7 +112,7 @@
             sb.append("/");
         } else {
             Class clazz = (Class) value;
-            if (!"javax.servlet.ServletException".equals(clazz.getName())) {
+            if (!"org.apache.tester.TesterException".equals(clazz.getName())) {
                 sb.append(" exception_type class is ");
                 sb.append(clazz.getName());
                 sb.append("/");

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to