diff --git a/CHANGELOG.md b/CHANGELOG.md index b0da60e5..9870a97b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Adjusted format detection to only return ENIGMA_DIR for non-empty directories with at least one `.mapping` file - Fixed writer NPEs when metadata or member source descriptors are null - Fixed SRG writer omitting fields with missing source descriptors +- Fixed Enigma directory reader never closing the individual files' readers ## [0.7.1] - 2025-01-07 - Restored the ability to read source-namespace-only mapping files, even if not spec-compliant diff --git a/src/main/java/net/fabricmc/mappingio/format/enigma/EnigmaDirReader.java b/src/main/java/net/fabricmc/mappingio/format/enigma/EnigmaDirReader.java index ef42bf20..42e822d2 100644 --- a/src/main/java/net/fabricmc/mappingio/format/enigma/EnigmaDirReader.java +++ b/src/main/java/net/fabricmc/mappingio/format/enigma/EnigmaDirReader.java @@ -16,6 +16,7 @@ package net.fabricmc.mappingio.format.enigma; +import java.io.BufferedReader; import java.io.IOException; import java.nio.file.FileVisitResult; import java.nio.file.Files; @@ -92,7 +93,9 @@ public boolean visitEnd() throws IOException { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { if (file.getFileName().toString().endsWith("." + MappingFormat.ENIGMA_FILE.fileExt)) { - EnigmaFileReader.read(Files.newBufferedReader(file), sourceNs, targetNs, delegatingVisitor); + try (BufferedReader reader = Files.newBufferedReader(file)) { + EnigmaFileReader.read(reader, sourceNs, targetNs, delegatingVisitor); + } } return FileVisitResult.CONTINUE;