Browse Source

close JarFile stream after getManifest (#197)

pull/205/head
Hao Xiang 7 years ago committed by Decebal Suiu
parent
commit
e80aae6c1f
  1. 4
      pf4j/src/main/java/org/pf4j/ManifestPluginDescriptorFinder.java

4
pf4j/src/main/java/org/pf4j/ManifestPluginDescriptorFinder.java

@ -51,8 +51,8 @@ public class ManifestPluginDescriptorFinder implements PluginDescriptorFinder {
protected Manifest readManifest(Path pluginPath) throws PluginException { protected Manifest readManifest(Path pluginPath) throws PluginException {
if (FileUtils.isJarFile(pluginPath)) { if (FileUtils.isJarFile(pluginPath)) {
try { try(JarFile jar = new JarFile(pluginPath.toFile())) {
Manifest manifest = new JarFile(pluginPath.toFile()).getManifest(); Manifest manifest = jar.getManifest();
if (manifest != null) { if (manifest != null) {
return manifest; return manifest;
} }

Loading…
Cancel
Save