From 628195df7eb025c6832238b4ba329cf06a284035 Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Tue, 18 Jun 2013 11:42:44 +0200 Subject: [PATCH] SONARPLUGINS-2979 Allow empty list for "sonar.sources" property --- .../runner/batch/ProjectReactorBuilder.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/sonar-runner-batch/src/main/java/org/sonar/runner/batch/ProjectReactorBuilder.java b/sonar-runner-batch/src/main/java/org/sonar/runner/batch/ProjectReactorBuilder.java index e17ffbd..bdc6d79 100644 --- a/sonar-runner-batch/src/main/java/org/sonar/runner/batch/ProjectReactorBuilder.java +++ b/sonar-runner-batch/src/main/java/org/sonar/runner/batch/ProjectReactorBuilder.java @@ -22,7 +22,10 @@ package org.sonar.runner.batch; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.Lists; import org.apache.commons.io.IOUtils; -import org.apache.commons.io.filefilter.*; +import org.apache.commons.io.filefilter.AndFileFilter; +import org.apache.commons.io.filefilter.FileFileFilter; +import org.apache.commons.io.filefilter.IOFileFilter; +import org.apache.commons.io.filefilter.WildcardFileFilter; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -33,8 +36,12 @@ import java.io.File; import java.io.FileFilter; import java.io.FileInputStream; import java.io.IOException; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import java.util.Map.Entry; +import java.util.Properties; /** * Class that creates a Sonar project definition based on a set of properties. @@ -89,7 +96,7 @@ class ProjectReactorBuilder { * Array of all mandatory properties required for a project without child. */ private static final String[] MANDATORY_PROPERTIES_FOR_SIMPLE_PROJECT = { - PROPERTY_PROJECT_BASEDIR, PROPERTY_PROJECT_KEY, PROPERTY_PROJECT_NAME, PROPERTY_PROJECT_VERSION, PROPERTY_SOURCES + PROPERTY_PROJECT_BASEDIR, PROPERTY_PROJECT_KEY, PROPERTY_PROJECT_NAME, PROPERTY_PROJECT_VERSION }; /** @@ -138,8 +145,8 @@ class ProjectReactorBuilder { } ProjectDefinition definition = ProjectDefinition.create().setProperties(properties) - .setBaseDir(baseDir) - .setWorkDir(workDir); + .setBaseDir(baseDir) + .setWorkDir(workDir); return definition; } @@ -382,7 +389,7 @@ class ProjectReactorBuilder { if (sourceFolder.isDirectory()) { LOG.warn("/!\\ A multi-module project can't have source folders, so '{}' won't be used for the analysis. " + "If you want to analyse files of this folder, you should create another sub-module and move them inside it.", - sourceFolder.toString()); + sourceFolder.toString()); } } @@ -485,7 +492,7 @@ class ProjectReactorBuilder { filePattern = pattern.substring(i + 1); } List filters = new ArrayList(); - if (pattern.indexOf('*')>=0) { + if (pattern.indexOf('*') >= 0) { filters.add(FileFileFilter.FILE); } filters.add(new WildcardFileFilter(filePattern)); -- 2.39.5