diff options
author | Duarte Meneses <duarte.meneses@sonarsource.com> | 2015-09-14 16:46:35 +0200 |
---|---|---|
committer | Duarte Meneses <duarte.meneses@sonarsource.com> | 2015-09-14 17:29:40 +0200 |
commit | 4af51da20823591001d85f2b7d1135d5bc9de51d (patch) | |
tree | d1627930d096907cae7fae317f918224ee910c07 /sonar-home/src/main | |
parent | 069f75fe8558dbea2c7194465f84c5b025bdd672 (diff) | |
download | sonarqube-4af51da20823591001d85f2b7d1135d5bc9de51d.tar.gz sonarqube-4af51da20823591001d85f2b7d1135d5bc9de51d.zip |
Improve FileCache tests
Diffstat (limited to 'sonar-home/src/main')
-rw-r--r-- | sonar-home/src/main/java/org/sonar/home/cache/FileCacheBuilder.java | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/sonar-home/src/main/java/org/sonar/home/cache/FileCacheBuilder.java b/sonar-home/src/main/java/org/sonar/home/cache/FileCacheBuilder.java index b4fd0da96d8..e8027081aac 100644 --- a/sonar-home/src/main/java/org/sonar/home/cache/FileCacheBuilder.java +++ b/sonar-home/src/main/java/org/sonar/home/cache/FileCacheBuilder.java @@ -20,12 +20,12 @@ package org.sonar.home.cache; import java.io.File; + import javax.annotation.Nullable; public class FileCacheBuilder { - + private final Logger logger; private File userHome; - private Logger logger; public FileCacheBuilder(Logger logger) { this.logger = logger; @@ -43,14 +43,18 @@ public class FileCacheBuilder { public FileCache build() { if (userHome == null) { - String path = System.getenv("SONAR_USER_HOME"); - if (path == null) { - // Default - path = System.getProperty("user.home") + File.separator + ".sonar"; - } - userHome = new File(path); + userHome = findHome(); } File cacheDir = new File(userHome, "cache"); return FileCache.create(cacheDir, logger); } + + private File findHome() { + String path = System.getenv("SONAR_USER_HOME"); + if (path == null) { + // Default + path = System.getProperty("user.home") + File.separator + ".sonar"; + } + return new File(path); + } } |