tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
Date Mon, 19 Jul 2004 20:17:55 GMT
markt       2004/07/19 13:17:55

  Modified:    jasper2/src/share/org/apache/jasper/compiler Tag:
                        tomcat_4_branch Compiler.java
  Log:
  Fix bug 26025. Close the stream to avoid FD leak
  .
   - Based on a patch provided by Wladimir Araujo
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.18.2.18 +15 -6     jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java
  
  Index: Compiler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v
  retrieving revision 1.18.2.17
  retrieving revision 1.18.2.18
  diff -u -r1.18.2.17 -r1.18.2.18
  --- Compiler.java	22 May 2004 16:55:14 -0000	1.18.2.17
  +++ Compiler.java	19 Jul 2004 20:17:55 -0000	1.18.2.18
  @@ -63,6 +63,8 @@
   import java.util.*;
   import java.io.*;
   import java.net.URL;
  +import java.net.URLConnection;
  +
   import javax.servlet.ServletException;
   import javax.servlet.Servlet;
   
  @@ -407,7 +409,10 @@
                   ctxt.incrementRemoved();
                   return false;
               }
  -            jspRealLastModified = jspUrl.openConnection().getLastModified();
  +
  +            URLConnection conn = jspUrl.openConnection();        
  +            jspRealLastModified = conn.getLastModified();
  +            conn.getInputStream().close();
           } catch (Exception e) {
               e.printStackTrace();
               return true;
  @@ -468,8 +473,12 @@
                       //System.out.println("Compiler: outdated, no includeUri " + include
);
                       return true;
                   }
  -                if (includeUrl.openConnection().getLastModified() >
  -                    targetLastModified) {
  +
  +                URLConnection includeUrlConn = includeUrl.openConnection();
  +                long includeLastModified = includeUrlConn.getLastModified();
  +                includeUrlConn.getInputStream().close();
  +
  +                if (includeLastModified > targetLastModified) {
                       //System.out.println("Compiler: outdated, include old " + include );
                       return true;
                   }
  
  
  

---------------------------------------------------------------------
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