Plug a `JarInputStream` resource leak

This commit is contained in:
Ben Liblit 2017-08-17 11:40:04 -05:00 committed by Manu Sridharan
parent 4cb4273ff9
commit 3825c03b16
1 changed files with 1 additions and 2 deletions

View File

@ -316,8 +316,7 @@ public class ClassLoaderImpl implements IClassLoader {
return null;
}
Map<String, Object> result = HashMapFactory.make();
try {
JarInputStream s = new JarInputStream(new ByteArrayInputStream(jarFileContents), false);
try (final JarInputStream s = new JarInputStream(new ByteArrayInputStream(jarFileContents), false)) {
JarEntry entry = null;
while ((entry = s.getNextJarEntry()) != null) {
byte[] entryBytes = getEntryBytes(entrySizesForFile.get(entry.getName()), s);