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;
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);
log.warn("Cannot scan " + file, e);
if (log.isTraceEnabled())
e.printStackTrace();
+ } finally {
+ IOUtils.closeQuietly(jarFile);
}
}
}