fixed a file descriptor leak

This commit is contained in:
hneemann 2017-10-29 09:35:37 +01:00
parent 23c096a179
commit 12ddec9a7b

View File

@ -51,7 +51,10 @@ public class JarComponentManager implements ComponentManager, Iterable<JarCompon
* @throws InvalidNodeException InvalidNodeException
*/
public void loadJar(File file) throws IOException, InvalidNodeException {
Manifest manifest = new JarFile(file).getManifest();
Manifest manifest;
try (JarFile jarFile = new JarFile(file)) {
manifest = jarFile.getManifest();
}
if (manifest == null)
throw new IOException(Lang.get("err_noManifestFound"));
Attributes attr = manifest.getMainAttributes();