Safer JSON Loading
By: Suddenly <suddenly@suddenly.coffee>
This commit is contained in:
parent
c4d2bdfd85
commit
0076297721
2 changed files with 24 additions and 2 deletions
|
@ -53,7 +53,19 @@
|
|||
|
||||
Objects.requireNonNull(list);
|
||||
optional.ifPresent(list::add);
|
||||
@@ -261,7 +261,7 @@
|
||||
@@ -250,6 +250,11 @@
|
||||
}
|
||||
} catch (FileNotFoundException filenotfoundexception) {
|
||||
;
|
||||
+ // Spigot Start
|
||||
+ } catch (com.google.gson.JsonSyntaxException | NullPointerException ex) {
|
||||
+ GameProfileCache.LOGGER.warn( "Usercache.json is corrupted or has bad formatting. Deleting it to prevent further issues." );
|
||||
+ this.file.delete();
|
||||
+ // Spigot End
|
||||
} catch (JsonParseException | IOException ioexception) {
|
||||
GameProfileCache.LOGGER.warn("Failed to load profile cache {}", this.file, ioexception);
|
||||
}
|
||||
@@ -261,7 +266,7 @@
|
||||
JsonArray jsonarray = new JsonArray();
|
||||
DateFormat dateformat = GameProfileCache.createDateFormat();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue