Skip to content

Commit

Permalink
Merge pull request #1 from Tofpu/open-closeable-fix
Browse files Browse the repository at this point in the history
Closes an open input stream
  • Loading branch information
Tofpu authored Sep 24, 2023
2 parents ccf1216 + 5054b8e commit 577cbac
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ public void load(final File fromFile) {
}

Map<String, Object> loadedMap;
try {
loadedMap = this.yaml.load(new FileInputStream(fromFile));
} catch (FileNotFoundException e) {
try (InputStream inputStream = Files.newInputStream(fromFile.toPath())) {
loadedMap = this.yaml.load(inputStream);
} catch (IOException e) {
throw new RuntimeException(e);
}
if (loadedMap != null && loadedMap.size() != 0) {
Expand Down

0 comments on commit 577cbac

Please sign in to comment.