tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java
Date Tue, 13 Jul 2004 15:04:37 GMT
remm        2004/07/13 08:04:37

  Modified:    catalina/src/share/org/apache/catalina/servlets
                        DefaultServlet.java
  Log:
  - Prevent a silent ISE when serving a file with a 0 content-length.
  
  Revision  Changes    Path
  1.25      +10 -2     jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- DefaultServlet.java	13 Jul 2004 09:43:19 -0000	1.24
  +++ DefaultServlet.java	13 Jul 2004 15:04:37 -0000	1.25
  @@ -775,6 +775,7 @@
           }
   
           Vector ranges = null;
  +        long contentLength = -1L;
   
           if (cacheEntry.context != null) {
   
  @@ -800,6 +801,14 @@
               response.setHeader("Last-Modified", 
                       cacheEntry.attributes.getLastModifiedHttp());
   
  +            // Get content length
  +            contentLength = cacheEntry.attributes.getContentLength();
  +            // Special case for zero length files, which would cause a 
  +            // (silent) ISE when setting the output buffer size
  +            if (contentLength == 0L) {
  +                content = false;
  +            }
  +            
           }
   
           ServletOutputStream ostream = null;
  @@ -835,7 +844,6 @@
                           contentType + "'");
                   response.setContentType(contentType);
               }
  -            long contentLength = cacheEntry.attributes.getContentLength();
               if ((cacheEntry.resource != null) && (contentLength >= 0)) {
                   if (debug > 0)
                       log("DefaultServlet.serveFile:  contentLength=" +
  
  
  

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


Mime
View raw message