From 18d70e7bc677cc1bd2e7c14f917543d88ac26ac9 Mon Sep 17 00:00:00 2001 From: Roel Spilker Date: Thu, 16 Jan 2020 00:13:44 +0100 Subject: Close more inputstreams --- src/launch/lombok/launch/ShadowClassLoader.java | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'src/launch/lombok') diff --git a/src/launch/lombok/launch/ShadowClassLoader.java b/src/launch/lombok/launch/ShadowClassLoader.java index f2a21a4e..30ca6e97 100644 --- a/src/launch/lombok/launch/ShadowClassLoader.java +++ b/src/launch/lombok/launch/ShadowClassLoader.java @@ -364,16 +364,20 @@ class ShadowClassLoader extends ClassLoader { FileInputStream jar = new FileInputStream(jarLoc); try { ZipInputStream zip = new ZipInputStream(jar); - while (true) { - ZipEntry entry = zip.getNextEntry(); - if (entry == null) { - jarLocCache.put(key, false); - return false; + try { + while (true) { + ZipEntry entry = zip.getNextEntry(); + if (entry == null) { + jarLocCache.put(key, false); + return false; + } + if (!"META-INF/ShadowClassLoader".equals(entry.getName())) continue; + boolean v = sclFileContainsSuffix(zip, suffix); + jarLocCache.put(key, v); + return v; } - if (!"META-INF/ShadowClassLoader".equals(entry.getName())) continue; - boolean v = sclFileContainsSuffix(zip, suffix); - jarLocCache.put(key, v); - return v; + } finally { + zip.close(); } } finally { jar.close(); -- cgit