fix: Fix file handle leak from 3x zip file logic backport
@@ -63,7 +63,7 @@ public class JarResource extends ArchiveResource {
// This may not always be ideal, but this way has one major bonus. It totally ignores CRC validity.
// It also ignores a few other zip entry values.
// Since somebody can intentionally write bogus data there to crash "ZipInputStream" this way works.
- ZipFile zf = new ZipFile(getPath().toString());
+ try (ZipFile zf = new ZipFile(getPath().toString())) {
Enumeration<? extends ZipEntry> entries = zf.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = entries.nextElement();
@@ -79,6 +79,7 @@ public class JarResource extends ArchiveResource {
}
}
}
+ }
loader.finishClasses();
return loader.getClasses();
}
