Author: fschumacher Date: Sun Sep 21 12:55:15 2014 New Revision: 1626579 URL: http://svn.apache.org/r1626579 Log: Fix a potential resource leak in JDTCompiler when checking wether a resource is a package. Reported by Coverity Scan.
Modified: tomcat/trunk/java/org/apache/jasper/compiler/JDTCompiler.java tomcat/trunk/webapps/docs/changelog.xml Modified: tomcat/trunk/java/org/apache/jasper/compiler/JDTCompiler.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/JDTCompiler.java?rev=1626579&r1=1626578&r2=1626579&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/jasper/compiler/JDTCompiler.java (original) +++ tomcat/trunk/java/org/apache/jasper/compiler/JDTCompiler.java Sun Sep 21 12:55:15 2014 @@ -226,9 +226,13 @@ public class JDTCompiler extends org.apa return false; } String resourceName = result.replace('.', '/') + ".class"; - InputStream is = - classLoader.getResourceAsStream(resourceName); - return is == null; + try (InputStream is = + classLoader.getResourceAsStream(resourceName)) { + return is == null; + } catch (IOException e) { + // we are here, since close on is failed. That means it was not null + return false; + } } @Override Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1626579&r1=1626578&r2=1626579&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Sun Sep 21 12:55:15 2014 @@ -185,6 +185,10 @@ jar files. Reported by Coverity Scan. Patch provided by Felix Schumacher. (violetagg) </fix> + <fix> + Fix a potential resource leak in JDTCompiler when checking wether + a resource is a package. Reported by Coverity Scan. (fschumacher) + </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