]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - org.argeo.slc.core/src/org/argeo/slc/osgi/FileSystemBundleRegister.java
Adapt to changes in Spring and OSGi (mostly generics)
[gpl/argeo-slc.git] / org.argeo.slc.core / src / org / argeo / slc / osgi / FileSystemBundleRegister.java
index a068a4f8c65e0a5226591502e44f544ba9c06bf2..03f21c5304e2217530fb9181bb046ad382454178 100644 (file)
@@ -22,6 +22,7 @@ import java.util.Set;
 import java.util.jar.JarFile;
 import java.util.jar.Manifest;
 
+import org.apache.commons.io.IOUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.osgi.framework.Constants;
@@ -50,8 +51,9 @@ public class FileSystemBundleRegister implements BundleRegister {
                        if (file.isDirectory()) {
 
                        } else {
+                               JarFile jarFile = null;
                                try {
-                                       JarFile jarFile = new JarFile(file);
+                                       jarFile = new JarFile(file);
                                        Manifest manifest = jarFile.getManifest();
                                        String symbolicName = manifest.getMainAttributes()
                                                        .getValue(Constants.BUNDLE_SYMBOLICNAME);
@@ -73,6 +75,8 @@ public class FileSystemBundleRegister implements BundleRegister {
                                        log.warn("Cannot scan " + file, e);
                                        if (log.isTraceEnabled())
                                                e.printStackTrace();
+                               } finally {
+                                       IOUtils.closeQuietly(jarFile);
                                }
                        }
                }