Skip to content

Commit 5250ed3

Browse files
cputnam-a11ycputnam-a11y
andauthored
Close resource streams for mixin configs. (FabricMC#185)
* Close resource streams for mixin configs. * Close resource streams for mixin configs. * Simplify * Remove Unneeded changes & Import --------- Co-authored-by: cputnam-a11y <unknown@cputnam-a11y.github.io>
1 parent 5c563d9 commit 5250ed3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/main/java/org/spongepowered/asm/mixin/transformer/MixinConfig.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,9 +1394,11 @@ static Config create(String configFile, MixinEnvironment outer, IMixinConfigSour
13941394
if (resource == null) {
13951395
throw new IllegalArgumentException(String.format("The specified resource '%s' was invalid or could not be read", configFile));
13961396
}
1397-
MixinConfig config = new Gson().fromJson(new InputStreamReader(resource), MixinConfig.class);
1398-
if (config.onLoad(service, configFile, outer, source)) {
1399-
return config.getHandle();
1397+
try (InputStreamReader reader = new InputStreamReader(resource)) {
1398+
MixinConfig config = new Gson().fromJson(reader, MixinConfig.class);
1399+
if (config.onLoad(service, configFile, outer, source)) {
1400+
return config.getHandle();
1401+
}
14001402
}
14011403
return null;
14021404
} catch (IllegalArgumentException ex) {

0 commit comments

Comments
 (0)