You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by vi...@apache.org on 2014/09/03 13:49:56 UTC

svn commit: r1622228 - in /tomcat/trunk: java/org/apache/catalina/util/ExtensionValidator.java webapps/docs/changelog.xml

Author: violetagg
Date: Wed Sep  3 11:49:56 2014
New Revision: 1622228

URL: http://svn.apache.org/r1622228
Log:
Fix a potential resource leak when reading MANIFEST.MF file for extension dependencies reported by Coverity Scan.

Modified:
    tomcat/trunk/java/org/apache/catalina/util/ExtensionValidator.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/catalina/util/ExtensionValidator.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/util/ExtensionValidator.java?rev=1622228&r1=1622227&r2=1622228&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/util/ExtensionValidator.java (original)
+++ tomcat/trunk/java/org/apache/catalina/util/ExtensionValidator.java Wed Sep  3 11:49:56 2014
@@ -169,14 +169,14 @@ public final class ExtensionValidator {
      * @param jarFile The system JAR whose manifest to add
      */
     public static void addSystemResource(File jarFile) throws IOException {
-        Manifest manifest = getManifest(new FileInputStream(jarFile));
-        if (manifest != null)  {
-            ManifestResource mre
-                = new ManifestResource(jarFile.getAbsolutePath(),
-                                       manifest,
-                                       ManifestResource.SYSTEM);
-            containerManifestResources.add(mre);
-        }
+        try (InputStream is = new FileInputStream(jarFile)) {
+            Manifest manifest = getManifest(is);
+            if (manifest != null) {
+                ManifestResource mre = new ManifestResource(jarFile.getAbsolutePath(), manifest,
+                        ManifestResource.SYSTEM);
+                containerManifestResources.add(mre);
+            }
+        } 
     }
 
 

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1622228&r1=1622227&r2=1622228&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Wed Sep  3 11:49:56 2014
@@ -94,6 +94,10 @@
         used so that multiple values for a header XXX are separated by commas.
         Identified by Coverity Scan. (violetagg)
       </fix>
+      <fix>
+        Fix a potential resource leak when reading MANIFEST.MF file for
+        extension dependencies reported by Coverity Scan. (violetagg)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Jasper">



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