Author: violetagg Date: Wed Sep 3 19:59:59 2014 New Revision: 1622342 URL: http://svn.apache.org/r1622342 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56908 Fix some potential resource leaks when reading jar files. Reported by Coverity Scan. Patch provided by Felix Schumacher.
Modified: tomcat/trunk/java/org/apache/jasper/compiler/Compiler.java tomcat/trunk/webapps/docs/changelog.xml Modified: tomcat/trunk/java/org/apache/jasper/compiler/Compiler.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/Compiler.java?rev=1622342&r1=1622341&r2=1622342&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/jasper/compiler/Compiler.java (original) +++ tomcat/trunk/java/org/apache/jasper/compiler/Compiler.java Wed Sep 3 19:59:59 2014 @@ -484,8 +484,9 @@ public abstract class Compiler { // Assume we constructed this correctly int entryStart = key.lastIndexOf("!/"); String entry = key.substring(entryStart + 2); - Jar jar = JarFactory.newInstance(new URL(key.substring(4, entryStart))); - includeLastModified = jar.getLastModified(entry); + try (Jar jar = JarFactory.newInstance(new URL(key.substring(4, entryStart)))) { + includeLastModified = jar.getLastModified(entry); + } } else { if (key.startsWith("jar:") || key.startsWith("file:")) { includeUrl = new URL(key); Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1622342&r1=1622341&r2=1622342&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Wed Sep 3 19:59:59 2014 @@ -114,6 +114,11 @@ will throw <code>IOException</code> when an I/O error occur during the operation. (violetagg) </fix> + <fix> + <bug>56908</bug>: Fix some potential resource leaks when reading + jar files. Reported by Coverity Scan. Patch provided by Felix + Schumacher. (violetagg) + </fix> </changelog> </subsection> <subsection name="WebSocket"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org