mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-04-03 05:57:42 -05:00
migrate to try-with-resources
This commit is contained in:
@@ -83,8 +83,7 @@ public final class MixinRefmapHelper {
|
||||
ZipUtil.iterate(output, (stream, entry) -> {
|
||||
if (!entry.isDirectory() && entry.getName().endsWith(".json") && !entry.getName().contains("/") && !entry.getName().contains("\\")) {
|
||||
// JSON file in root directory
|
||||
InputStreamReader inputStreamReader = new InputStreamReader(stream);
|
||||
try {
|
||||
try (InputStreamReader inputStreamReader = new InputStreamReader(stream)) {
|
||||
JsonObject json = GSON.fromJson(inputStreamReader, JsonObject.class);
|
||||
|
||||
if (json != null) {
|
||||
@@ -100,9 +99,6 @@ public final class MixinRefmapHelper {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// ...
|
||||
} finally {
|
||||
inputStreamReader.close();
|
||||
stream.close();
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -116,17 +112,13 @@ public final class MixinRefmapHelper {
|
||||
ZipUtil.iterate(output, (stream, entry) -> {
|
||||
if (!entry.isDirectory() && entry.getName().endsWith(".json") && !entry.getName().contains("/") && !entry.getName().contains("\\")) {
|
||||
// JSON file in root directory
|
||||
InputStreamReader inputStreamReader = new InputStreamReader(stream);
|
||||
try {
|
||||
try (InputStreamReader inputStreamReader = new InputStreamReader(stream)) {
|
||||
JsonObject json = GSON.fromJson(inputStreamReader, JsonObject.class);
|
||||
if (json != null && json.has("refmap")) {
|
||||
mixinRefmapFilenames.add(json.get("refmap").getAsString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// ...
|
||||
} finally {
|
||||
inputStreamReader.close();
|
||||
stream.close();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user