You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2001/12/17 21:21:12 UTC

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/valves ErrorReportValve.java

remm        01/12/17 12:21:12

  Modified:    catalina/src/share/org/apache/catalina/valves
                        ErrorReportValve.java
  Log:
  - Fix a problem where an exception report thrown from a servlet or a JSP would
    not get properly displayed. The bug was caused because sendError now suspends
    the response.
  
  Revision  Changes    Path
  1.7       +13 -12    jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/valves/ErrorReportValve.java
  
  Index: ErrorReportValve.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/valves/ErrorReportValve.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ErrorReportValve.java	2001/10/15 01:11:59	1.6
  +++ ErrorReportValve.java	2001/12/17 20:21:11	1.7
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/valves/ErrorReportValve.java,v 1.6 2001/10/15 01:11:59 remm Exp $
  - * $Revision: 1.6 $
  - * $Date: 2001/10/15 01:11:59 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/valves/ErrorReportValve.java,v 1.7 2001/12/17 20:21:11 remm Exp $
  + * $Revision: 1.7 $
  + * $Date: 2001/12/17 20:21:11 $
    *
    * ====================================================================
    *
  @@ -104,7 +104,7 @@
    * @author Craig R. McClanahan
    * @author <a href="mailto:nicolaken@supereva.it">Nicola Ken Barozzi</a> Aisa
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version $Revision: 1.6 $ $Date: 2001/10/15 01:11:59 $
  + * @version $Revision: 1.7 $ $Date: 2001/12/17 20:21:11 $
    */
   
   public class ErrorReportValve
  @@ -169,16 +169,15 @@
           // Perform the request
           context.invokeNext(request, response);
   
  -        ServletResponse sresp = (ServletResponse) response;
  -        if (sresp.isCommitted())
  -            return;
  -
  -        response.setSuspended(false);
  -
           ServletRequest sreq = (ServletRequest) request;
           Throwable throwable = 
               (Throwable) sreq.getAttribute(Globals.EXCEPTION_ATTR);
   
  +        ServletResponse sresp = (ServletResponse) response;
  +        if (sresp.isCommitted()) {
  +            return;
  +        }
  +
           if (throwable != null) {
   
               // The response is an error
  @@ -198,6 +197,8 @@
   
           }
   
  +        response.setSuspended(false);
  +
           try {
               report(request, response, throwable);
           } catch (Throwable tt) {
  @@ -253,7 +254,7 @@
           // Do nothing on an OK status
           if (statusCode == HttpServletResponse.SC_OK)
               return;
  -        // Do nothing on a NO MODIFIED status
  +        // Do nothing on a NOT MODIFIED status
           if (statusCode == HttpServletResponse.SC_NOT_MODIFIED)
               return;
           // Do nothing on a NO CONTENT status
  @@ -358,7 +359,7 @@
               Writer writer = response.getReporter();
               if (writer != null) {
                   // If writer is null, it's an indication that the response has
  -                // been hard committed already
  +                // been hard committed already, which should never happen
                   writer.write(sb.toString());
                   writer.flush();
               }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>