aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java
index 52ce46a1..e447e4a9 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java
@@ -46,9 +46,11 @@ import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
+import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Type;
import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -317,11 +319,9 @@ public class FairySouls {
public void loadFoundSoulsForAllProfiles(File file, Gson gson) {
allProfilesFoundSouls = new HashMap<>();
String fileContent;
- try {
- fileContent = new BufferedReader(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8))
- .lines()
- .collect(Collectors.joining(System.lineSeparator()));
- } catch (FileNotFoundException e) {
+ try (BufferedReader br = Files.newBufferedReader(file.toPath())) {
+ fileContent = br.lines().collect(Collectors.joining(System.lineSeparator()));
+ } catch (IOException e) {
// it is possible that the collected_fairy_souls.json won't exist
return;
}