diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2017-09-11 17:13:16 +0200 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2017-09-15 08:51:08 +0200 |
commit | 1de512a131f84fb1b6656150347d2b075b478780 (patch) | |
tree | 577caa9c9b3d56763e298cec5b286dd31178ff5e /sonar-scanner-engine/src/main/java/org | |
parent | f76f82c6ef66e60e4986521d141514763e5c405a (diff) | |
download | sonarqube-1de512a131f84fb1b6656150347d2b075b478780.tar.gz sonarqube-1de512a131f84fb1b6656150347d2b075b478780.zip |
SONAR-9223 Properly handle case when SONAR_USER_HOME point to a symlink
Diffstat (limited to 'sonar-scanner-engine/src/main/java/org')
-rw-r--r-- | sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/GlobalTempFolderProvider.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/GlobalTempFolderProvider.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/GlobalTempFolderProvider.java index 5b6de50c622..8be618a3e4b 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/GlobalTempFolderProvider.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/GlobalTempFolderProvider.java @@ -44,7 +44,7 @@ public class GlobalTempFolderProvider extends ProviderAdapter implements Compone private static final long CLEAN_MAX_AGE = TimeUnit.DAYS.toMillis(21); static final String TMP_NAME_PREFIX = ".sonartmp_"; private boolean started = false; - + private System2 system; private DefaultTempFolder tempFolder; @@ -66,7 +66,6 @@ public class GlobalTempFolderProvider extends ProviderAdapter implements Compone Path home = findSonarHome(bootstrapProps); workingPath = home.resolve(workingPath).normalize(); } - try { cleanTempFolders(workingPath); } catch (IOException e) { @@ -80,7 +79,11 @@ public class GlobalTempFolderProvider extends ProviderAdapter implements Compone private static Path createTempFolder(Path workingPath) { try { - Files.createDirectories(workingPath); + Path realPath = workingPath; + if (Files.isSymbolicLink(realPath)) { + realPath = realPath.toRealPath(); + } + Files.createDirectories(realPath); } catch (IOException e) { throw new IllegalStateException("Failed to create working path: " + workingPath, e); } @@ -160,7 +163,7 @@ public class GlobalTempFolderProvider extends ProviderAdapter implements Compone @Override public void dispose(PicoContainer container) { - //nothing to do + // nothing to do } @Override |