From 9963f42534c2ed037a0c38bb72a3815313e4fb35 Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Wed, 30 Jan 2013 10:24:51 +0100 Subject: SONAR-2291 Generate a new bootstrap index with md5 to allow caching by Sonar Runner. --- .../src/main/java/org/sonar/batch/cache/SonarCache.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'sonar-batch') diff --git a/sonar-batch/src/main/java/org/sonar/batch/cache/SonarCache.java b/sonar-batch/src/main/java/org/sonar/batch/cache/SonarCache.java index b503dc463df..da4caca7ee3 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/cache/SonarCache.java +++ b/sonar-batch/src/main/java/org/sonar/batch/cache/SonarCache.java @@ -25,7 +25,6 @@ import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.io.FileUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.sonar.api.utils.SonarException; import java.io.File; import java.io.FileInputStream; @@ -57,11 +56,11 @@ public class SonarCache { this.cacheLocation = cacheLocation; tmpDir = new File(cacheLocation, ".tmp"); if (!cacheLocation.exists()) { - LOG.debug("Creating cache directory: " + cacheLocation.getAbsolutePath()); + LOG.debug("Creating cache directory: {}", cacheLocation.getAbsolutePath()); try { FileUtils.forceMkdir(cacheLocation); } catch (IOException e) { - throw new SonarException("Unable to create cache directory " + cacheLocation.getAbsolutePath(), e); + throw new RuntimeException("Unable to create cache directory " + cacheLocation.getAbsolutePath(), e); } } } @@ -125,7 +124,7 @@ public class SonarCache { if (!rename) { // Check if the file was already in cache if (!finalFileName.exists()) { - LOG.warn("Unable to rename " + tmpFileName.getAbsolutePath() + " to " + finalFileName.getAbsolutePath()); + LOG.warn("Unable to rename {} to {}", tmpFileName.getAbsolutePath(), finalFileName.getAbsolutePath()); LOG.warn("A copy/delete will be tempted but with no garantee of atomicity"); FileUtils.moveFile(tmpFileName, finalFileName); } @@ -183,11 +182,11 @@ public class SonarCache { public File getTmpDir() { if (!tmpDir.exists()) { - LOG.debug("Creating temporary cache directory: " + tmpDir.getAbsolutePath()); + LOG.debug("Creating temporary cache directory: {}", tmpDir.getAbsolutePath()); try { FileUtils.forceMkdir(tmpDir); } catch (IOException e) { - throw new SonarException("Unable to create temporary cache directory " + tmpDir.getAbsolutePath(), e); + throw new RuntimeException("Unable to create temporary cache directory " + tmpDir.getAbsolutePath(), e); } } return tmpDir; -- cgit v1.2.3