felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mccu...@apache.org
Subject svn commit: r683332 - /felix/trunk/bundleplugin/src/main/java/org/apache/maven/shared/osgi/DefaultMaven2OsgiConverter.java
Date Wed, 06 Aug 2008 17:14:26 GMT
Author: mcculls
Date: Wed Aug  6 10:14:25 2008
New Revision: 683332

URL: http://svn.apache.org/viewvc?rev=683332&view=rev
Log:
FELIX-661: remember to close JarFiles (also raised under MSHARED-53)

Modified:
    felix/trunk/bundleplugin/src/main/java/org/apache/maven/shared/osgi/DefaultMaven2OsgiConverter.java

Modified: felix/trunk/bundleplugin/src/main/java/org/apache/maven/shared/osgi/DefaultMaven2OsgiConverter.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/org/apache/maven/shared/osgi/DefaultMaven2OsgiConverter.java?rev=683332&r1=683331&r2=683332&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/org/apache/maven/shared/osgi/DefaultMaven2OsgiConverter.java
(original)
+++ felix/trunk/bundleplugin/src/main/java/org/apache/maven/shared/osgi/DefaultMaven2OsgiConverter.java
Wed Aug  6 10:14:25 2008
@@ -82,9 +82,10 @@
         {
             Analyzer analyzer = new Analyzer();
 
+            JarFile jar = null;
             try
             {
-                JarFile jar = new JarFile( artifact.getFile(), false );
+                jar = new JarFile( artifact.getFile(), false );
 
                 if ( jar.getManifest() != null )
                 {
@@ -104,6 +105,19 @@
                 throw new ManifestReadingException( "Error reading manifest in jar "
                     + artifact.getFile().getAbsolutePath(), e );
             }
+            finally
+            {
+                if ( jar != null )
+                {
+                    try
+                    {
+                        jar.close();
+                    }
+                    catch ( IOException e )
+                    {
+                    }
+                }
+            }
         }
 
         int i = artifact.getGroupId().lastIndexOf( '.' );
@@ -156,6 +170,7 @@
                     }
                 }
             }
+            jar.close();
 
             /* find the top package */
             String[] groupIdSections = null;



Mime
View raw message