Skip to content

Commit

Permalink
Fix no try with resource statements
Browse files Browse the repository at this point in the history
  • Loading branch information
jumanji144 committed Mar 1, 2024
1 parent 0620661 commit 5d4ad35
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,8 @@ private void save() {
}
}

try {
BufferedWriter writer = Files.newBufferedWriter(containerPath);
try(JsonWriter writer = new JsonWriter(Files.newBufferedWriter(containerPath))) {
gson.toJson(json, writer);
writer.close();
} catch (IOException e) {
logger.error("Failed to save config container: {}", key, e);
}
Expand All @@ -103,8 +101,7 @@ private void load() {
}

JsonObject json;
try {
JsonReader reader = new JsonReader(Files.newBufferedReader(containerPath));
try (JsonReader reader = new JsonReader(Files.newBufferedReader(containerPath))) {
json = gson.fromJson(reader, JsonObject.class);
} catch (IOException e) {
logger.error("Failed to load config container: {}", key, e);
Expand Down

0 comments on commit 5d4ad35

Please sign in to comment.