diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2014-04-03 18:13:34 +0200 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2014-04-03 18:13:34 +0200 |
commit | 33080cbd8883a540a0e366923d47ebbfb2683984 (patch) | |
tree | bfefb15d3a02137ee1529b06a4ecd0c5beb26396 /sonar-batch | |
parent | 533766d1cf443450a708c8cd1418921c9246f354 (diff) | |
download | sonarqube-33080cbd8883a540a0e366923d47ebbfb2683984.tar.gz sonarqube-33080cbd8883a540a0e366923d47ebbfb2683984.zip |
Fix some quality flaws
Diffstat (limited to 'sonar-batch')
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/scan/ProjectReactorBuilder.java | 13 |
1 files changed, 8 insertions, 5 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 181e66670d5..6fcd09ad568 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 @@ -35,11 +35,13 @@ import org.sonar.api.batch.bootstrap.ProjectReactor; import org.sonar.batch.bootstrap.BootstrapSettings; import javax.annotation.CheckForNull; +import javax.annotation.Nullable; import java.io.File; import java.io.FileFilter; import java.io.FileInputStream; import java.io.IOException; +import java.text.MessageFormat; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -51,6 +53,8 @@ import java.util.Properties; */ public class ProjectReactorBuilder { + private static final String INVALID_VALUE_OF_X_FOR_Y = "Invalid value of {0} for {1}"; + private static final Logger LOG = LoggerFactory.getLogger(ProjectReactorBuilder.class); /** @@ -114,7 +118,7 @@ public class ProjectReactorBuilder { return new ProjectReactor(rootProject); } - protected ProjectDefinition defineProject(Properties properties, ProjectDefinition parent) { + protected ProjectDefinition defineProject(Properties properties, @Nullable ProjectDefinition parent) { File baseDir = new File(properties.getProperty(PROPERTY_PROJECT_BASEDIR)); if (properties.containsKey(PROPERTY_MODULES)) { checkMandatoryProperties(properties, MANDATORY_PROPERTIES_FOR_MULTIMODULE_PROJECT); @@ -130,11 +134,10 @@ public class ProjectReactorBuilder { workDir = initModuleWorkDir(baseDir, properties); } - ProjectDefinition definition = ProjectDefinition.create().setProperties(properties) + return ProjectDefinition.create().setProperties(properties) .setBaseDir(baseDir) .setWorkDir(workDir) .setBuildDir(initModuleBuildDir(baseDir, properties)); - return definition; } @VisibleForTesting @@ -295,7 +298,7 @@ public class ProjectReactorBuilder { for (String pattern : getListFromProperty(props, PROPERTY_LIBRARIES)) { File[] files = getLibraries(baseDir, pattern); if (files == null || files.length == 0) { - LOG.error("Invalid value of " + PROPERTY_LIBRARIES + " for " + projectId); + LOG.error(MessageFormat.format(INVALID_VALUE_OF_X_FOR_Y, PROPERTY_LIBRARIES, projectId)); throw new IllegalStateException("No files nor directories matching '" + pattern + "' in directory " + baseDir); } } @@ -416,7 +419,7 @@ public class ProjectReactorBuilder { for (String path : sourceDirs) { File sourceFolder = resolvePath(baseDir, path); if (!sourceFolder.isDirectory()) { - LOG.error("Invalid value of " + propName + " for " + moduleRef); + LOG.error(MessageFormat.format(INVALID_VALUE_OF_X_FOR_Y, propName, moduleRef)); throw new IllegalStateException("The folder '" + path + "' does not exist for '" + moduleRef + "' (base directory = " + baseDir.getAbsolutePath() + ")"); } |