diff options
author | Duarte Meneses <duarte.meneses@sonarsource.com> | 2016-03-17 13:47:05 +0100 |
---|---|---|
committer | Duarte Meneses <duarte.meneses@sonarsource.com> | 2016-03-17 14:31:27 +0100 |
commit | 91720513ee12439d09703cc8837c3f5d40668ef1 (patch) | |
tree | 9fdaed068827bce39477069faf8ad9e57bb8614c | |
parent | 39494a3895c43b1b00768e7f3a23633d93491e22 (diff) | |
download | sonarqube-91720513ee12439d09703cc8837c3f5d40668ef1.tar.gz sonarqube-91720513ee12439d09703cc8837c3f5d40668ef1.zip |
SONAR-7273 API returns different paths in case of single-module and multi-module configurations
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/scan/ProjectReactorBuilder.java | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectReactorBuilder.java b/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectReactorBuilder.java index 59ee5a499aa..2d7e453cfaf 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectReactorBuilder.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectReactorBuilder.java @@ -23,7 +23,8 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import java.io.File; -import java.io.IOException; +import java.nio.file.Path; +import java.nio.file.Paths; import java.text.MessageFormat; import java.util.Arrays; import java.util.HashMap; @@ -399,19 +400,14 @@ public class ProjectReactorBuilder { "' (base directory = " + baseDir.getAbsolutePath() + ")"); } } - } protected static File resolvePath(File baseDir, String path) { - File file = new File(path); - if (!file.isAbsolute()) { - try { - file = new File(baseDir, path).getCanonicalFile(); - } catch (IOException e) { - throw new IllegalStateException("Unable to resolve path \"" + path + "\"", e); - } + Path filePath = Paths.get(path); + if (!filePath.isAbsolute()) { + filePath = baseDir.toPath().resolve(path); } - return file; + return filePath.normalize().toFile(); } /** |