Skip to content

Commit

Permalink
1.4.6 <=> Fixed rare NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
mynttt committed Jan 4, 2021
1 parent 65f4335 commit 79fc3a3
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 1.4.6
- Fixed rare NPE

## 1.4.5
- Fixed crash on malformed XML

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.5
1.4.6
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/updatetool/common/KeyValueStore.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package updatetool.common;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.HashMap;
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<String, String> map = new HashMap<>();
Expand All @@ -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<String, String> m = new Gson().fromJson(Files.readString(p, StandardCharsets.UTF_8), new TypeToken<HashMap<String, String>>() {}.getType());
cache.map.putAll(m);
} catch(JsonSyntaxException | IOException e) {}
} catch(Exception e) {}
return cache;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.5
1.4.6

0 comments on commit 79fc3a3

Please sign in to comment.