Skip to content

Commit 5597bc8

Browse files
authored
Don't forget to close individual files' readers in EnigmaDirReader (#128)
1 parent 1067889 commit 5597bc8

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
- Adjusted format detection to only return ENIGMA_DIR for non-empty directories with at least one `.mapping` file
1212
- Fixed writer NPEs when metadata or member source descriptors are null
1313
- Fixed SRG writer omitting fields with missing source descriptors
14+
- Fixed Enigma directory reader never closing the individual files' readers
1415

1516
## [0.7.1] - 2025-01-07
1617
- Restored the ability to read source-namespace-only mapping files, even if not spec-compliant

src/main/java/net/fabricmc/mappingio/format/enigma/EnigmaDirReader.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package net.fabricmc.mappingio.format.enigma;
1818

19+
import java.io.BufferedReader;
1920
import java.io.IOException;
2021
import java.nio.file.FileVisitResult;
2122
import java.nio.file.Files;
@@ -92,7 +93,9 @@ public boolean visitEnd() throws IOException {
9293
@Override
9394
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
9495
if (file.getFileName().toString().endsWith("." + MappingFormat.ENIGMA_FILE.fileExt)) {
95-
EnigmaFileReader.read(Files.newBufferedReader(file), sourceNs, targetNs, delegatingVisitor);
96+
try (BufferedReader reader = Files.newBufferedReader(file)) {
97+
EnigmaFileReader.read(reader, sourceNs, targetNs, delegatingVisitor);
98+
}
9699
}
97100

98101
return FileVisitResult.CONTINUE;

0 commit comments

Comments
 (0)