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 2008/11/03 15:28:17 UTC

svn commit: r710063 - /tomcat/trunk/java/org/apache/catalina/core/StandardHostValve.java

Author: markt
Date: Mon Nov  3 06:28:17 2008
New Revision: 710063

URL: http://svn.apache.org/viewvc?rev=710063&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=42409
The spec says reset the buffer, therefore use the resetBuffer() method. This makes custom and standard error handling consistent.

Modified:
    tomcat/trunk/java/org/apache/catalina/core/StandardHostValve.java

Modified: tomcat/trunk/java/org/apache/catalina/core/StandardHostValve.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardHostValve.java?rev=710063&r1=710062&r2=710063&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardHostValve.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardHostValve.java Mon Nov  3 06:28:17 2008
@@ -368,7 +368,7 @@
 
         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 @@
         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 =



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r710063 - /tomcat/trunk/java/org/apache/catalina/core/StandardHostValve.java

Posted by Mark Thomas <ma...@apache.org>.
Remy Maucherat wrote:
> On Mon, 2008-11-03 at 14:28 +0000, markt@apache.org wrote:
>> Author: markt
>> Date: Mon Nov  3 06:28:17 2008
>> New Revision: 710063
>>
>> URL: http://svn.apache.org/viewvc?rev=710063&view=rev
>> Log:
>> Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=42409
>> The spec says reset the buffer, therefore use the resetBuffer() method. This makes custom and standard error handling consistent.
> 
> The flags for writer and output streams are no longer reset. This means
> an ISE in many cases. Is that what you want ?

Probably not. I'll look into this more carefully today.

> Personally, I don't think the spec's language should be followed here.

It is ambiguous but I am in favour of standard error pages and custom
error pages behaving in as similar a way as possible.

Mark



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r710063 - /tomcat/trunk/java/org/apache/catalina/core/StandardHostValve.java

Posted by Remy Maucherat <re...@apache.org>.
On Mon, 2008-11-03 at 14:28 +0000, markt@apache.org wrote:
> Author: markt
> Date: Mon Nov  3 06:28:17 2008
> New Revision: 710063
> 
> URL: http://svn.apache.org/viewvc?rev=710063&view=rev
> Log:
> Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=42409
> The spec says reset the buffer, therefore use the resetBuffer() method. This makes custom and standard error handling consistent.

The flags for writer and output streams are no longer reset. This means
an ISE in many cases. Is that what you want ?

Personally, I don't think the spec's language should be followed here.

Rémy



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org