Author: markt Date: Wed Mar 4 21:00:49 2015 New Revision: 1664143 URL: http://svn.apache.org/r1664143 Log: Fix file leak. Need to make sure the JarURLConnection is explicitly closed. Leaving it to GC will cause random file locking.
Modified: tomcat/trunk/java/org/apache/catalina/startup/ExpandWar.java Modified: tomcat/trunk/java/org/apache/catalina/startup/ExpandWar.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/ExpandWar.java?rev=1664143&r1=1664142&r2=1664143&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/startup/ExpandWar.java (original) +++ tomcat/trunk/java/org/apache/catalina/startup/ExpandWar.java Wed Mar 4 21:00:49 2015 @@ -73,7 +73,7 @@ public class ExpandWar { throws IOException { // Open the connection to the WAR. There is no explicit close method. - // You have to get the JarFile and close that. + // You have to get the InputStream and close that. JarURLConnection juc = (JarURLConnection) war.openConnection(); juc.setUseCaches(false); @@ -82,7 +82,8 @@ public class ExpandWar { File docBase = new File(host.getAppBaseFile(), pathname); File warTracker = new File(host.getAppBaseFile(), pathname + Constants.WarTracker); - try (JarFile jarFile = juc.getJarFile()) { + try (JarFile jarFile = juc.getJarFile(); + InputStream is = juc.getInputStream()) { // Get the last modified time for the WAR long warLastModified = juc.getLastModified(); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org