Author: violetagg
Date: Wed Sep  3 12:45:58 2014
New Revision: 1622240

URL: http://svn.apache.org/r1622240
Log:
Merged revision 1622228 from tomcat/trunk:
Fix a potential resource leak when reading MANIFEST.MF file for extension 
dependencies reported by Coverity Scan.

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/util/ExtensionValidator.java
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1622228

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/util/ExtensionValidator.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/util/ExtensionValidator.java?rev=1622240&r1=1622239&r2=1622240&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/util/ExtensionValidator.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/util/ExtensionValidator.java 
Wed Sep  3 12:45:58 2014
@@ -224,13 +224,22 @@ 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);
+        InputStream is = null;
+        try {
+            is = new FileInputStream(jarFile);
+            Manifest manifest = getManifest(is);
+            if (manifest != null) {
+                ManifestResource mre = new 
ManifestResource(jarFile.getAbsolutePath(), manifest,
+                        ManifestResource.SYSTEM);
+                containerManifestResources.add(mre);
+            }
+        } finally {
+            if (is != null) {
+                try {
+                    is.close();
+                } catch (IOException e) {
+                }
+            }
         }
     }
 

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1622240&r1=1622239&r2=1622240&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Wed Sep  3 12:45:58 2014
@@ -122,6 +122,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="Coyote">



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

Reply via email to