From 79fc3a34a82708335d9e1924789f230b0b3ab3ac Mon Sep 17 00:00:00 2001 From: mynttt Date: Mon, 4 Jan 2021 14:39:19 +0100 Subject: [PATCH] 1.4.6 <=> Fixed rare NPE --- CHANGELOG.md | 3 +++ VERSION | 2 +- build.gradle | 2 +- src/main/java/updatetool/common/KeyValueStore.java | 6 +++--- src/main/resources/VERSION | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b78aa4..1ba7dd9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 1.4.6 +- Fixed rare NPE + ## 1.4.5 - Fixed crash on malformed XML diff --git a/VERSION b/VERSION index 03e5161..7b5753f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.4.5 \ No newline at end of file +1.4.6 \ No newline at end of file diff --git a/build.gradle b/build.gradle index a65489c..310d8bf 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ plugins { id 'com.github.spotbugs' version '2.0.1' } -version = '1.4.5' +version = '1.4.6' sourceCompatibility = '11' new File(projectDir, "VERSION").text = version; diff --git a/src/main/java/updatetool/common/KeyValueStore.java b/src/main/java/updatetool/common/KeyValueStore.java index e78a6a7..e306497 100644 --- a/src/main/java/updatetool/common/KeyValueStore.java +++ b/src/main/java/updatetool/common/KeyValueStore.java @@ -1,6 +1,5 @@ package updatetool.common; -import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; @@ -8,7 +7,7 @@ import java.util.concurrent.TimeUnit; import com.google.common.reflect.TypeToken; import com.google.gson.Gson; -import com.google.gson.JsonSyntaxException; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; public class KeyValueStore { private final HashMap map = new HashMap<>(); @@ -18,13 +17,14 @@ private KeyValueStore(Path p) { this.p = p; } + @SuppressFBWarnings("REC_CATCH_EXCEPTION") @SuppressWarnings("serial") public static KeyValueStore of(Path p) { var cache = new KeyValueStore(p); try { HashMap m = new Gson().fromJson(Files.readString(p, StandardCharsets.UTF_8), new TypeToken>() {}.getType()); cache.map.putAll(m); - } catch(JsonSyntaxException | IOException e) {} + } catch(Exception e) {} return cache; } diff --git a/src/main/resources/VERSION b/src/main/resources/VERSION index 03e5161..7b5753f 100644 --- a/src/main/resources/VERSION +++ b/src/main/resources/VERSION @@ -1 +1 @@ -1.4.5 \ No newline at end of file +1.4.6 \ No newline at end of file