diff --git a/pom.xml b/pom.xml index 877abce47..684a0dfdf 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ me.coley recaf https://github.com/Col-E/Recaf/ - 2.21.9 + 2.21.10 Recaf A modern java bytecode editor diff --git a/src/main/java/me/coley/recaf/Recaf.java b/src/main/java/me/coley/recaf/Recaf.java index 86a472520..657e786c0 100644 --- a/src/main/java/me/coley/recaf/Recaf.java +++ b/src/main/java/me/coley/recaf/Recaf.java @@ -31,7 +31,7 @@ * @author Matt */ public class Recaf { - public static final String VERSION = "2.21.9"; + public static final String VERSION = "2.21.10"; public static final String DOC_URL = "https://col-e.github.io/Recaf-documentation/"; public static final int ASM_VERSION = Opcodes.ASM9; private static Controller currentController; diff --git a/src/main/java/me/coley/recaf/workspace/JarResource.java b/src/main/java/me/coley/recaf/workspace/JarResource.java index 351428904..23e74684f 100644 --- a/src/main/java/me/coley/recaf/workspace/JarResource.java +++ b/src/main/java/me/coley/recaf/workspace/JarResource.java @@ -63,19 +63,20 @@ protected Map loadClasses() throws IOException { // 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()); - Enumeration entries = zf.entries(); - while (entries.hasMoreElements()) { - ZipEntry entry = entries.nextElement(); + try (ZipFile zf = new ZipFile(getPath().toString())) { + Enumeration entries = zf.entries(); + while (entries.hasMoreElements()) { + ZipEntry entry = entries.nextElement(); - if (shouldSkip(entry.getName())) - continue; - if (!loader.isValidClassEntry(entry)) - continue; + if (shouldSkip(entry.getName())) + continue; + if (!loader.isValidClassEntry(entry)) + continue; - InputStream zis = zf.getInputStream(entry); - byte[] in = IOUtil.toByteArray(zis); - loader.onClass(entry.getName(), in); + InputStream zis = zf.getInputStream(entry); + byte[] in = IOUtil.toByteArray(zis); + loader.onClass(entry.getName(), in); + } } } }