From c95f41167a3d2e30855e4d41a2bde8154ba754be Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Mon, 24 Mar 2014 11:01:26 +0100 Subject: [PATCH] SONAR-5062 Don't fail when concurrent process unzip same plugin dependency --- .../src/main/java/org/sonar/home/cache/FileCache.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 5898f7e4292..4ede4d4f56a 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 @@ -19,6 +19,7 @@ */ package org.sonar.home.cache; +import org.apache.commons.io.FileExistsException; import org.apache.commons.io.FileUtils; import org.sonar.api.utils.ZipUtils; import org.sonar.home.log.Log; @@ -187,7 +188,12 @@ public class FileCache { if (!destDir.exists()) { File tempDir = createTempDir(); ZipUtils.unzip(cachedFile, tempDir, new LibFilter()); - FileUtils.moveDirectory(tempDir, destDir); + // Recheck in case a concurrent process + try { + FileUtils.moveDirectory(tempDir, destDir); + } catch (FileExistsException e) { + // Ignore as is certainly means a concurrent process has unziped the same file + } } return destDir; } -- 2.39.5