You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by pa...@apache.org on 2020/07/07 20:47:54 UTC

[felix-dev] branch master updated: [FELIX-6297] MultiReleaseContent leaks manifest InputStream

This is an automated email from the ASF dual-hosted git repository.

pauls pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/felix-dev.git


The following commit(s) were added to refs/heads/master by this push:
     new 1a11ec9b [FELIX-6297] MultiReleaseContent leaks manifest InputStream
     new b9c7ebe  Merge pull request #31 from jpleasu/FELIX-6297-unclosed-inputstream-on-bundle-start
1a11ec9b is described below

commit 1a11ec9b2db5ccd8ff635bc6959a037345ea478d
Author: Jason P. Leasure <jp...@gmail.com>
AuthorDate: Tue Jul 7 09:37:04 2020 -0400

    [FELIX-6297] MultiReleaseContent leaks manifest InputStream
---
 .../org/apache/felix/framework/util/MultiReleaseContent.java   | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/framework/src/main/java/org/apache/felix/framework/util/MultiReleaseContent.java b/framework/src/main/java/org/apache/felix/framework/util/MultiReleaseContent.java
index 00e84d9..9653029 100644
--- a/framework/src/main/java/org/apache/felix/framework/util/MultiReleaseContent.java
+++ b/framework/src/main/java/org/apache/felix/framework/util/MultiReleaseContent.java
@@ -63,12 +63,14 @@ public class MultiReleaseContent implements Content
         {
             try
             {
-                InputStream manifestStream = content.getEntryAsStream("META-INF/MANIFEST.MF");
-                if (manifestStream != null)
+                try (InputStream manifestStream = content.getEntryAsStream("META-INF/MANIFEST.MF"))
                 {
-                    if ("true".equals(new Manifest(manifestStream).getMainAttributes().getValue("Multi-Release")))
+                    if (manifestStream != null)
                     {
-                        content = new MultiReleaseContent(javaVersion, content);
+                        if ("true".equals(new Manifest(manifestStream).getMainAttributes().getValue("Multi-Release")))
+                        {
+                            content = new MultiReleaseContent(javaVersion, content);
+                        }
                     }
                 }
             }