From e80aae6c1f613c8248e7161c7d83c66109f2a7d5 Mon Sep 17 00:00:00 2001 From: Hao Xiang Date: Tue, 23 Jan 2018 18:31:45 +0800 Subject: [PATCH] close JarFile stream after getManifest (#197) --- .../main/java/org/pf4j/ManifestPluginDescriptorFinder.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pf4j/src/main/java/org/pf4j/ManifestPluginDescriptorFinder.java b/pf4j/src/main/java/org/pf4j/ManifestPluginDescriptorFinder.java index e2bac20..47f4d72 100644 --- a/pf4j/src/main/java/org/pf4j/ManifestPluginDescriptorFinder.java +++ b/pf4j/src/main/java/org/pf4j/ManifestPluginDescriptorFinder.java @@ -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; }