aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-home
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2013-02-13 23:12:41 +0100
committerSimon Brandhof <simon.brandhof@gmail.com>2013-02-13 23:12:41 +0100
commit84792078764ce7e6dbdffabb03f40f3bf2bb37b7 (patch)
treee26db56c81249666ef6345bf302a2c33e7e08860 /sonar-home
parent963f99920272b142ce0bcfa091bd85ee61fee369 (diff)
downloadsonarqube-84792078764ce7e6dbdffabb03f40f3bf2bb37b7.tar.gz
sonarqube-84792078764ce7e6dbdffabb03f40f3bf2bb37b7.zip
Fix quality flaws
Diffstat (limited to 'sonar-home')
-rw-r--r--sonar-home/src/main/java/org/sonar/home/cache/FileCache.java18
1 files changed, 8 insertions, 10 deletions
diff --git a/sonar-home/src/main/java/org/sonar/home/cache/FileCache.java b/sonar-home/src/main/java/org/sonar/home/cache/FileCache.java
index cab5cd9d635..0d2d457b040 100644
--- a/sonar-home/src/main/java/org/sonar/home/cache/FileCache.java
+++ b/sonar-home/src/main/java/org/sonar/home/cache/FileCache.java
@@ -103,16 +103,14 @@ public class FileCache {
private void renameQuietly(File sourceFile, File targetFile) {
boolean rename = sourceFile.renameTo(targetFile);
- if (!rename) {
- // Check if the file was cached by another process during download
- if (!targetFile.exists()) {
- log.warn(String.format("Unable to rename %s to %s", sourceFile.getAbsolutePath(), targetFile.getAbsolutePath()));
- log.warn(String.format("A copy/delete will be tempted but with no garantee of atomicity"));
- try {
- FileUtils.moveFile(sourceFile, targetFile);
- } catch (IOException e) {
- throw new IllegalStateException("Fail to move " + sourceFile.getAbsolutePath() + " to " + targetFile, e);
- }
+ // Check if the file was cached by another process during download
+ if (!rename && !targetFile.exists()) {
+ log.warn(String.format("Unable to rename %s to %s", sourceFile.getAbsolutePath(), targetFile.getAbsolutePath()));
+ log.warn(String.format("A copy/delete will be tempted but with no garantee of atomicity"));
+ try {
+ FileUtils.moveFile(sourceFile, targetFile);
+ } catch (IOException e) {
+ throw new IllegalStateException("Fail to move " + sourceFile.getAbsolutePath() + " to " + targetFile, e);
}
}
}