diff --git a/parser/src/main/java/com/linkedin/avroutil1/parser/avsc/AvscParser.java b/parser/src/main/java/com/linkedin/avroutil1/parser/avsc/AvscParser.java index d2dfed0f..03b6b753 100644 --- a/parser/src/main/java/com/linkedin/avroutil1/parser/avsc/AvscParser.java +++ b/parser/src/main/java/com/linkedin/avroutil1/parser/avsc/AvscParser.java @@ -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) {