diff options
3 files changed, 15 insertions, 10 deletions
diff --git a/sonar-runner-api/src/main/java/org/sonar/runner/api/EmbeddedRunner.java b/sonar-runner-api/src/main/java/org/sonar/runner/api/EmbeddedRunner.java index f83218f..fe14024 100644 --- a/sonar-runner-api/src/main/java/org/sonar/runner/api/EmbeddedRunner.java +++ b/sonar-runner-api/src/main/java/org/sonar/runner/api/EmbeddedRunner.java @@ -36,7 +36,7 @@ public class EmbeddedRunner extends Runner<EmbeddedRunner> { private final BatchLauncher batchLauncher; private final List<Object> extensions = new ArrayList<Object>(); - private final static String MASK_RULES_PROP = "sonarRunner.maskRules"; + private static final String MASK_RULES_PROP = "sonarRunner.maskRules"; EmbeddedRunner(BatchLauncher bl) { this.batchLauncher = bl; diff --git a/sonar-runner-api/src/main/java/org/sonar/runner/api/Runner.java b/sonar-runner-api/src/main/java/org/sonar/runner/api/Runner.java index afa5c37..85dd22f 100644 --- a/sonar-runner-api/src/main/java/org/sonar/runner/api/Runner.java +++ b/sonar-runner-api/src/main/java/org/sonar/runner/api/Runner.java @@ -22,6 +22,7 @@ package org.sonar.runner.api; import org.sonar.runner.impl.InternalProperties; import javax.annotation.Nullable; + import java.util.Properties; /** @@ -93,7 +94,6 @@ public abstract class Runner<T extends Runner> { private void initDefaultValues() { setDefaultValue(RunnerProperties.HOST_URL, "http://localhost:9000"); - //setDefaultValue(RunnerProperties.TASK, "scan"); setDefaultValue(InternalProperties.RUNNER_APP, "SonarRunner"); setDefaultValue(InternalProperties.RUNNER_APP_VERSION, RunnerVersion.version()); } diff --git a/sonar-runner-impl/src/main/java/org/sonar/runner/impl/BatchLauncher.java b/sonar-runner-impl/src/main/java/org/sonar/runner/impl/BatchLauncher.java index 96c28db..a862a38 100644 --- a/sonar-runner-impl/src/main/java/org/sonar/runner/impl/BatchLauncher.java +++ b/sonar-runner-impl/src/main/java/org/sonar/runner/impl/BatchLauncher.java @@ -50,6 +50,18 @@ public class BatchLauncher { doExecute(jarDownloader, props, extensions); } + private static String[][] getMaskRules(final Properties props) { + String maskRulesProp = props.getProperty(InternalProperties.RUNNER_MASK_RULES, null); + String[] maskRulesConcat = maskRulesProp != null ? maskRulesProp.split(",") : new String[0]; + String[][] maskRules = new String[maskRulesConcat.length][2]; + for (int i = 0; i < maskRulesConcat.length; i++) { + String[] splitted = maskRulesConcat[i].split("\\|"); + maskRules[i][0] = splitted[0]; + maskRules[i][1] = splitted.length > 1 ? splitted[1] : ""; + } + return maskRules; + } + /** * @return the {@link org.sonar.runner.batch.IsolatedLauncher} instance for unit tests */ @@ -57,14 +69,7 @@ public class BatchLauncher { Object launcher = AccessController.doPrivileged(new PrivilegedAction<Object>() { public Object run() { List<File> jarFiles = jarDownloader.download(); - String maskRulesProp = props.getProperty(InternalProperties.RUNNER_MASK_RULES, null); - String[] maskRulesConcat = maskRulesProp != null ? maskRulesProp.split(",") : new String[0]; - String[][] maskRules = new String[maskRulesConcat.length][2]; - for (int i = 0; i < maskRulesConcat.length; i++) { - String[] splitted = maskRulesConcat[i].split("\\|"); - maskRules[i][0] = splitted[0]; - maskRules[i][1] = splitted.length > 1 ? splitted[1] : ""; - } + String[][] maskRules = getMaskRules(props); IsolatedClassloader classloader = new IsolatedClassloader(getClass().getClassLoader(), maskRules); classloader.addFiles(jarFiles); Object launcher = delegateExecution(classloader, props, extensions); |