]> source.dussan.org Git - pf4j.git/commitdiff
close JarFile stream after getManifest (#197)
authorHao Xiang <haoxiangzhao@outlook.com>
Tue, 23 Jan 2018 10:31:45 +0000 (18:31 +0800)
committerDecebal Suiu <decebal.suiu@gmail.com>
Tue, 23 Jan 2018 10:31:45 +0000 (12:31 +0200)
pf4j/src/main/java/org/pf4j/ManifestPluginDescriptorFinder.java

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