mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 14:35:45 +01:00
Use cache with size zero to avoid null checks
This commit is contained in:
@@ -81,9 +81,9 @@ public class DefaultUberWebResourceLoader implements UberWebResourceLoader
|
||||
this.cache = createCache(stage);
|
||||
}
|
||||
|
||||
private final Cache<String, URL> createCache(Stage stage) {
|
||||
private Cache<String, URL> createCache(Stage stage) {
|
||||
if (stage == Stage.DEVELOPMENT) {
|
||||
return null;
|
||||
return CacheBuilder.newBuilder().maximumSize(0).build(); // Disable caching
|
||||
}
|
||||
return CacheBuilder.newBuilder().build();
|
||||
}
|
||||
@@ -121,17 +121,12 @@ public class DefaultUberWebResourceLoader implements UberWebResourceLoader
|
||||
}
|
||||
|
||||
private URL getFromCache(String path) {
|
||||
if (cache != null) {
|
||||
return cache.getIfPresent(path);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void addToCache(String path, URL url) {
|
||||
if (cache != null) {
|
||||
cache.put(path, url);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
|
||||
Reference in New Issue
Block a user