Skip to content

Commit

Permalink
ensure FileReader close()es during avro parse
Browse files Browse the repository at this point in the history
  • Loading branch information
dg-builder authored Apr 29, 2024
1 parent 9321e76 commit 2631cd0
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,12 @@ public AvscParseResult parse(Path avscFile) {

public AvscParseResult parse(File avscFile) {
AvscFileParseContext context = new AvscFileParseContext(avscFile, this);
Reader reader;
try {
reader = new FileReader(avscFile);
;
try (Reader reader = new FileReader(avscFile)) {
return parse(context, reader);
} catch (FileNotFoundException e) {
throw new IllegalStateException("input file " + avscFile.getAbsolutePath() + " not found", e);
}
return parse(context, reader);
}

private AvscParseResult parse(AvscFileParseContext context, Reader reader) {
Expand Down

0 comments on commit 2631cd0

Please sign in to comment.