diff options
Diffstat (limited to 'sonar-home')
-rw-r--r-- | sonar-home/src/main/java/org/sonar/home/cache/FileCache.java | 18 |
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); } } } |