]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7273 API returns different paths in case of single-module and multi-module... 849/head
authorDuarte Meneses <duarte.meneses@sonarsource.com>
Thu, 17 Mar 2016 12:47:05 +0000 (13:47 +0100)
committerDuarte Meneses <duarte.meneses@sonarsource.com>
Thu, 17 Mar 2016 13:31:27 +0000 (14:31 +0100)
sonar-batch/src/main/java/org/sonar/batch/scan/ProjectReactorBuilder.java

index 59ee5a499aa1bc7d24569dbd9c0936c585a42579..2d7e453cfaf83190893c856f98a98d93c3c514f3 100644 (file)
@@ -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();
   }
 
   /**