Author: hibou
Date: Sat Jul 16 16:08:55 2011
New Revision: 1147446

URL: http://svn.apache.org/viewvc?rev=1147446&view=rev
Log:
IVY-1305:
 - File descriptor leak in OSGI repo core while running buildobr Ant Task 
Thanks to Stephen Evanchik.

Modified:
    ant/ivy/core/trunk/CHANGES.txt
    
ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/AbstractFSManifestIterable.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=1147446&r1=1147445&r2=1147446&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Sat Jul 16 16:08:55 2011
@@ -38,6 +38,7 @@ for detailed view of each issue, please 
        Flavio Coutinho da Costa
        Stefan De Boey
        Martin Eigenbrodt
+       Stephen Evanchik
        Gregory Fernandez
        Danno Ferrin
        Benjamin Francisoud     

Modified: 
ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/AbstractFSManifestIterable.java
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/AbstractFSManifestIterable.java?rev=1147446&r1=1147445&r2=1147446&view=diff
==============================================================================
--- 
ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/AbstractFSManifestIterable.java
 (original)
+++ 
ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/AbstractFSManifestIterable.java
 Sat Jul 16 16:08:55 2011
@@ -95,8 +95,9 @@ public abstract class AbstractFSManifest
                     }
                 } else if (bundleCandidates.hasNext()) {
                     String bundleCandidate = (String) bundleCandidates.next();
+                    JarInputStream in = null;
                     try {
-                        JarInputStream in = new 
JarInputStream(getInputStream(bundleCandidate));
+                        in = new 
JarInputStream(getInputStream(bundleCandidate));
                         Manifest manifest = in.getManifest();
                         if (manifest != null) {
                             next = new ManifestAndLocation(manifest,
@@ -108,6 +109,14 @@ public abstract class AbstractFSManifest
                         Message.debug("Jar file just removed: " + 
bundleCandidate + " (" + e + ")");
                     } catch (IOException e) {
                         Message.warn("Unreadable jar: " + bundleCandidate + " 
(" + e + ")");
+                    } finally {
+                        if (in != null) {
+                            try {
+                                in.close();
+                            } catch (IOException e) {
+                                // Don't care
+                            }
+                        }
                     }
                 } else {
                     // no more candidate on the current directory
@@ -137,4 +146,4 @@ public abstract class AbstractFSManifest
             throw new UnsupportedOperationException();
         }
     }
-}
\ No newline at end of file
+}


Reply via email to