[FIX] Crash corrupted sessions.json

This commit is contained in:
Gravita 2021-05-04 19:39:10 +07:00
parent ea7159dba6
commit 5b5da76bff

View file

@ -102,8 +102,8 @@ public void dumpSessionsData() {
Path path = Paths.get(dumpFile);
try (Writer writer = IOHelper.newWriter(path)) {
Launcher.gsonManager.gson.toJson(dumpedData, writer);
} catch (IOException e) {
logger.error(e);
} catch (Throwable e) {
logger.error("Sessions can't be saved", e);
}
}
@ -114,8 +114,8 @@ public void loadSessionsData() {
DumpedData data = Launcher.gsonManager.gson.fromJson(reader, DumpedData.class);
clientSet.putAll(data.clientSet);
uuidIndex.putAll(data.uuidIndex);
} catch (IOException e) {
logger.error(e);
} catch (Throwable e) {
logger.error("Sessions can't be loaded", e);
}
}