Ensure JarFile is always closed
parent
f7190b31c0
commit
26755cb82c
|
@ -83,7 +83,7 @@ public class ModProcessor {
|
|||
}
|
||||
|
||||
private static void handleNestedJars(File input, Project project, Configuration config, ResolvedArtifact artifact) throws IOException {
|
||||
JarFile jarFile = new JarFile(input);
|
||||
try (JarFile jarFile = new JarFile(input)) {
|
||||
JarEntry modJsonEntry = jarFile.getJarEntry("fabric.mod.json");
|
||||
|
||||
if (modJsonEntry == null) {
|
||||
|
@ -106,8 +106,7 @@ public class ModProcessor {
|
|||
processNestedJar(jarFile, fileName, project, config, artifact);
|
||||
}
|
||||
}
|
||||
|
||||
jarFile.close();
|
||||
}
|
||||
}
|
||||
|
||||
private static void processNestedJar(JarFile parentJar, String fileName, Project project, Configuration config, ResolvedArtifact artifact) throws IOException {
|
||||
|
@ -150,15 +149,15 @@ public class ModProcessor {
|
|||
}
|
||||
|
||||
private static void remapaccessWidener(File input, Project project) throws IOException {
|
||||
JarFile jarFile = new JarFile(input);
|
||||
String accessWidenerPath;
|
||||
|
||||
try (JarFile jarFile = new JarFile(input)) {
|
||||
JarEntry modJsonEntry = jarFile.getJarEntry("fabric.mod.json");
|
||||
|
||||
if (modJsonEntry == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
String accessWidenerPath;
|
||||
|
||||
try (InputStream inputStream = jarFile.getInputStream(modJsonEntry)) {
|
||||
JsonObject json = GSON.fromJson(new InputStreamReader(inputStream), JsonObject.class);
|
||||
|
||||
|
@ -168,8 +167,7 @@ public class ModProcessor {
|
|||
|
||||
accessWidenerPath = json.get("accessWidener").getAsString();
|
||||
}
|
||||
|
||||
jarFile.close();
|
||||
}
|
||||
|
||||
if (accessWidenerPath == null) {
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue