diff --git a/std-bits/base/src/main/java/org/enso/base/cache/LRUCache.java b/std-bits/base/src/main/java/org/enso/base/cache/LRUCache.java index 4e17b51565..9368cfe74e 100644 --- a/std-bits/base/src/main/java/org/enso/base/cache/LRUCache.java +++ b/std-bits/base/src/main/java/org/enso/base/cache/LRUCache.java @@ -99,7 +99,7 @@ public class LRUCache { */ private CacheResult makeRequestAndCache(String cacheKey, ItemBuilder itemBuilder) throws IOException, InterruptedException, ResponseTooLargeException { - assert !cache.containsKey(cacheKey); + assert !cache.containsKey(cacheKey) : "Cache should not contain key " + cacheKey; Item item = itemBuilder.buildItem(); @@ -135,7 +135,9 @@ public class LRUCache { return getResultForCacheEntry(cacheKey); } catch (IOException e) { logger.log( - Level.WARNING, "Failure storing cache entry; will re-execute without caching: {}", e); + Level.WARNING, + "Failure storing cache entry; will re-execute without caching: {}", + e.getMessage()); // Re-issue the request since we don't know if we've consumed any of the response. Item rerequested = itemBuilder.buildItem(); return new CacheResult<>(rerequested.stream(), rerequested.metadata()); @@ -255,7 +257,8 @@ public class LRUCache { toRemove.add(mapEntry); totalSize -= mapEntry.getValue().size(); } - assert totalSize <= maxTotalCacheSize; + assert totalSize <= maxTotalCacheSize + : "totalSize > maxTotalCacheSize (" + totalSize + " > " + maxTotalCacheSize + ")"; removeCacheEntries(toRemove); } diff --git a/std-bits/base/src/main/java/org/enso/base/cache/LRUCacheSettings.java b/std-bits/base/src/main/java/org/enso/base/cache/LRUCacheSettings.java index 2678b9add3..ef5075a453 100644 --- a/std-bits/base/src/main/java/org/enso/base/cache/LRUCacheSettings.java +++ b/std-bits/base/src/main/java/org/enso/base/cache/LRUCacheSettings.java @@ -71,7 +71,7 @@ public class LRUCacheSettings { "Unable to parse environment variable " + MAX_FILE_SIZE_ENV_VAR + ": {}, falling back to default", - e); + e.getMessage()); return DEFAULT_MAX_FILE_SIZE; } } @@ -92,7 +92,7 @@ public class LRUCacheSettings { "Unable to parse environment variable " + TOTAL_CACHE_SIZE_ENV_VAR + ": {}, falling back to default", - e); + e.getMessage()); return new TotalCacheLimit.Percentage(DEFAULT_TOTAL_CACHE_SIZE_FREE_SPACE_PERCENTAGE); } }