aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-home
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2015-08-27 16:58:34 +0200
committerDuarte Meneses <duarte.meneses@sonarsource.com>2015-08-28 15:54:30 +0200
commit22f39e39acdf84be933aab9d6c1b10455e0e4033 (patch)
tree358928c6fc18d197a009300ee49ac7bb863af961 /sonar-home
parente6950401a73e7ed1eb5401805528475c6b59f71a (diff)
downloadsonarqube-22f39e39acdf84be933aab9d6c1b10455e0e4033.tar.gz
sonarqube-22f39e39acdf84be933aab9d6c1b10455e0e4033.zip
SONAR-6577 Offline mode in issues mode
Diffstat (limited to 'sonar-home')
-rw-r--r--sonar-home/src/main/java/org/sonar/home/cache/PersistentCache.java4
-rw-r--r--sonar-home/src/test/java/org/sonar/home/cache/PersistentCacheTest.java7
2 files changed, 9 insertions, 2 deletions
diff --git a/sonar-home/src/main/java/org/sonar/home/cache/PersistentCache.java b/sonar-home/src/main/java/org/sonar/home/cache/PersistentCache.java
index 2193f5a1ba4..c5c45090ed4 100644
--- a/sonar-home/src/main/java/org/sonar/home/cache/PersistentCache.java
+++ b/sonar-home/src/main/java/org/sonar/home/cache/PersistentCache.java
@@ -76,7 +76,9 @@ public class PersistentCache {
@CheckForNull
public synchronized String getString(@Nonnull String obj, @Nullable final PersistentCacheLoader<String> valueLoader) throws IOException {
- byte[] cached = get(obj, new ValueLoaderDecoder(valueLoader));
+ ValueLoaderDecoder decoder = valueLoader != null ? new ValueLoaderDecoder(valueLoader) : null;
+
+ byte[] cached = get(obj, decoder);
if (cached == null) {
return null;
diff --git a/sonar-home/src/test/java/org/sonar/home/cache/PersistentCacheTest.java b/sonar-home/src/test/java/org/sonar/home/cache/PersistentCacheTest.java
index 72f594bf7d1..9760b096676 100644
--- a/sonar-home/src/test/java/org/sonar/home/cache/PersistentCacheTest.java
+++ b/sonar-home/src/test/java/org/sonar/home/cache/PersistentCacheTest.java
@@ -20,7 +20,6 @@
package org.sonar.home.cache;
import java.io.File;
-import java.io.IOException;
import org.apache.commons.io.FileUtils;
import org.junit.Before;
@@ -55,6 +54,12 @@ public class PersistentCacheTest {
assertThat(cache.get(URI, null)).isNull();
assertCacheHit(false);
}
+
+ @Test
+ public void testNullLoaderString() throws Exception {
+ assertThat(cache.getString(URI, null)).isNull();
+ assertCacheHit(false);
+ }
@Test
public void testNullValue() throws Exception {