Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=42409
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 3 Nov 2008 14:28:17 +0000 (14:28 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 3 Nov 2008 14:28:17 +0000 (14:28 +0000)
The spec says reset the buffer, therefore use the resetBuffer() method. This makes custom and standard error handling consistent.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@710063 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/core/StandardHostValve.java

index 186ce3b..79b920c 100644 (file)
@@ -368,7 +368,7 @@ final class StandardHostValve
 
         if (exception == null)
             return (null);
-        Class clazz = exception.getClass();
+        Class<?> clazz = exception.getClass();
         String name = clazz.getName();
         while (!Object.class.equals(clazz)) {
             ErrorPage errorPage = context.findErrorPage(name);
@@ -405,16 +405,8 @@ final class StandardHostValve
         request.setPathInfo(errorPage.getLocation());
 
         try {
-
-            // Reset the response if possible (else IllegalStateException)
-            //hres.reset();
             // Reset the response (keeping the real error code and message)
-            Integer statusCodeObj =
-                (Integer) request.getAttribute(Globals.STATUS_CODE_ATTR);
-            int statusCode = statusCodeObj.intValue();
-            String message =
-                (String) request.getAttribute(Globals.ERROR_MESSAGE_ATTR);
-            response.reset(statusCode, message);
+            response.resetBuffer();
 
             // Forward control to the specified location
             ServletContext servletContext =