Skip to content

Commit 6951b3a

Browse files
committed
fix errors by catching wrong exception
1 parent 76170a4 commit 6951b3a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/net/ornithemc/ploceus/LibraryUpgradesCache.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
import java.io.BufferedReader;
44
import java.io.BufferedWriter;
5-
import java.io.FileNotFoundException;
65
import java.io.InputStreamReader;
76
import java.net.URI;
87
import java.nio.file.Files;
8+
import java.nio.file.NoSuchFileException;
99
import java.nio.file.Path;
1010
import java.util.ArrayList;
1111
import java.util.List;
@@ -128,7 +128,7 @@ private List<Library> getLibrariesFromCache() throws Exception {
128128

129129
try (BufferedReader br = Files.newBufferedReader(libsCache)) {
130130
json = GSON.fromJson(br, JsonObject.class);
131-
} catch (FileNotFoundException e) {
131+
} catch (NoSuchFileException e) {
132132
return null;
133133
}
134134

@@ -157,7 +157,7 @@ private void saveLibrariesToCache(List<Library> libs) throws Exception {
157157

158158
try (BufferedReader br = Files.newBufferedReader(libsCache)) {
159159
json = GSON.fromJson(br, JsonObject.class);
160-
} catch (FileNotFoundException e) {
160+
} catch (NoSuchFileException e) {
161161
json = new JsonObject();
162162
}
163163

0 commit comments

Comments
 (0)