Explicitly close the stream.
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 24 Nov 2009 01:15:19 +0000 (01:15 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 24 Nov 2009 01:15:19 +0000 (01:15 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@883562 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/util/ExtensionValidator.java

index 5fed5ac..19c561a 100644 (file)
@@ -188,7 +188,8 @@ public final class ExtensionValidator {
                     continue;
                 }
                 Resource resource = (Resource) obj;
-                Manifest jmanifest = getManifest(resource.streamContent());
+                inputStream = resource.streamContent();
+                Manifest jmanifest = getManifest(inputStream);
                 if (jmanifest != null) {
                     ManifestResource mre = new ManifestResource(
                                                 binding.getName(),
@@ -200,6 +201,14 @@ public final class ExtensionValidator {
         } catch (NamingException nex) {
             // Jump out of the check for this application because it 
             // has no resources
+        } finally {
+            if (inputStream != null) {
+                try {
+                    inputStream.close();
+                } catch (Throwable t) {
+                    // Ignore
+                }
+            }
         }
 
         return validateManifestResources(appName, appManifestResources);