From 8a7e4f29f3bd94cb15fac81c59c2f07c9dddf70b Mon Sep 17 00:00:00 2001 From: Andrea Cavalli Date: Tue, 28 Aug 2018 02:49:57 +0200 Subject: [PATCH] TeaVM startup crash fixed --- .../java/org/warp/picalculator/deps/StorageUtils.java | 1 - src/main/java/org/warp/picalculator/CacheUtils.java | 8 +++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/js-specific/java/org/warp/picalculator/deps/StorageUtils.java b/src/js-specific/java/org/warp/picalculator/deps/StorageUtils.java index 6d765dc4..a2ccf015 100644 --- a/src/js-specific/java/org/warp/picalculator/deps/StorageUtils.java +++ b/src/js-specific/java/org/warp/picalculator/deps/StorageUtils.java @@ -31,7 +31,6 @@ import org.apache.commons.io.Charsets; import org.apache.commons.io.IOUtils; import org.teavm.classlib.java.nio.charset.TCharset; import org.teavm.jso.browser.Window; -import org.warp.picalculator.Main; public class StorageUtils { public static final String basepath; diff --git a/src/main/java/org/warp/picalculator/CacheUtils.java b/src/main/java/org/warp/picalculator/CacheUtils.java index 071985cc..f09f736a 100644 --- a/src/main/java/org/warp/picalculator/CacheUtils.java +++ b/src/main/java/org/warp/picalculator/CacheUtils.java @@ -30,9 +30,11 @@ public class CacheUtils { private static void refreshEntry(String entryName) { synchronized (time) { synchronized (cache) { - if (time.getOrDefault(entryName, 0L) <= System.currentTimeMillis()) { - time.remove(entryName); - cache.remove(entryName); + if (time.containsKey(entryName)) { + if (time.get(entryName) <= System.currentTimeMillis()) { + time.remove(entryName); + cache.remove(entryName); + } } } }