remm        02/01/24 08:47:58

  Modified:    catalina/src/share/org/apache/catalina/valves
                        ErrorReportValve.java
  Log:
  - Don't set content-type when the reporter is null.
  - Fixes bug 5740.
  
  Revision  Changes    Path
  1.9       +16 -11    
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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ErrorReportValve.java     21 Dec 2001 21:15:45 -0000      1.8
  +++ ErrorReportValve.java     24 Jan 2002 16:47:58 -0000      1.9
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/valves/ErrorReportValve.java,v
 1.8 2001/12/21 21:15:45 craigmcc Exp $
  - * $Revision: 1.8 $
  - * $Date: 2001/12/21 21:15:45 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/valves/ErrorReportValve.java,v
 1.9 2002/01/24 16:47:58 remm Exp $
  + * $Revision: 1.9 $
  + * $Date: 2002/01/24 16:47:58 $
    *
    * ====================================================================
    *
  @@ -105,7 +105,7 @@
    * @author Craig R. McClanahan
    * @author <a href="mailto:[EMAIL PROTECTED]";>Nicola Ken Barozzi</a> Aisa
    * @author <a href="mailto:[EMAIL PROTECTED]";>Stefano Mazzocchi</a>
  - * @version $Revision: 1.8 $ $Date: 2001/12/21 21:15:45 $
  + * @version $Revision: 1.9 $ $Date: 2002/01/24 16:47:58 $
    */
   
   public class ErrorReportValve
  @@ -291,13 +291,6 @@
           if (report == null)
               return;
   
  -        try {
  -            hres.setContentType("text/html");
  -        } catch (Throwable t) {
  -            if (debug >= 1)
  -                log("status.setContentType", t);
  -        }
  -
           StringBuffer sb = new StringBuffer();
   
           sb.append("<html><head><title>");
  @@ -357,13 +350,25 @@
           sb.append("</body></html>");
   
           try {
  +
               Writer writer = response.getReporter();
  +
               if (writer != null) {
  +
  +                try {
  +                    hres.setContentType("text/html");
  +                } catch (Throwable t) {
  +                    if (debug >= 1)
  +                        log("status.setContentType", t);
  +                }
  +
                   // If writer is null, it's an indication that the response has
                   // been hard committed already, which should never happen
                   writer.write(sb.toString());
                   writer.flush();
  +
               }
  +
           } catch (IOException e) {
               ;
           } catch (IllegalStateException e) {
  
  
  

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

Reply via email to