aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-process-monitor/src
diff options
context:
space:
mode:
authorStephane Gamard <stephane.gamard@sonarsource.com>2014-10-08 14:01:17 +0200
committerStephane Gamard <stephane.gamard@sonarsource.com>2014-10-08 14:01:17 +0200
commitd5d20d0f777ba89b49575846c8f96afd316829f4 (patch)
tree257a0341add4bf8a00a20af45e623a548b357255 /server/sonar-process-monitor/src
parent0a890a7a3069e79bc1029f17ddc59c8fb4409274 (diff)
parent7eb13c86cafb14b8d7afbb3737a27fb3c6fe9d51 (diff)
downloadsonarqube-d5d20d0f777ba89b49575846c8f96afd316829f4.tar.gz
sonarqube-d5d20d0f777ba89b49575846c8f96afd316829f4.zip
Merge remote-tracking branch 'origin/branch-4.5'
Conflicts: server/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java sonar-batch/src/main/java/org/sonar/batch/scan2/DefaultFileLinesContextFactory.java
Diffstat (limited to 'server/sonar-process-monitor/src')
-rw-r--r--server/sonar-process-monitor/src/main/java/org/sonar/process/monitor/JavaCommand.java10
-rw-r--r--server/sonar-process-monitor/src/test/java/org/sonar/process/monitor/JavaCommandTest.java7
2 files changed, 14 insertions, 3 deletions
diff --git a/server/sonar-process-monitor/src/main/java/org/sonar/process/monitor/JavaCommand.java b/server/sonar-process-monitor/src/main/java/org/sonar/process/monitor/JavaCommand.java
index 7750b6deb35..76abf52deba 100644
--- a/server/sonar-process-monitor/src/main/java/org/sonar/process/monitor/JavaCommand.java
+++ b/server/sonar-process-monitor/src/main/java/org/sonar/process/monitor/JavaCommand.java
@@ -19,6 +19,8 @@
*/
package org.sonar.process.monitor;
+import org.apache.commons.lang.StringUtils;
+
import javax.annotation.Nullable;
import java.io.File;
@@ -84,12 +86,16 @@ public class JavaCommand {
}
public JavaCommand addJavaOption(String s) {
- javaOptions.add(s);
+ if (StringUtils.isNotBlank(s)) {
+ javaOptions.add(s);
+ }
return this;
}
public JavaCommand addJavaOptions(String s) {
- Collections.addAll(javaOptions, s.split(" "));
+ for (String opt : s.split(" ")) {
+ addJavaOption(opt);
+ }
return this;
}
diff --git a/server/sonar-process-monitor/src/test/java/org/sonar/process/monitor/JavaCommandTest.java b/server/sonar-process-monitor/src/test/java/org/sonar/process/monitor/JavaCommandTest.java
index fbfbad11b54..689f061ff06 100644
--- a/server/sonar-process-monitor/src/test/java/org/sonar/process/monitor/JavaCommandTest.java
+++ b/server/sonar-process-monitor/src/test/java/org/sonar/process/monitor/JavaCommandTest.java
@@ -65,8 +65,13 @@ public class JavaCommandTest {
}
@Test
- public void split_java_options() throws Exception {
+ public void add_java_options() throws Exception {
JavaCommand command = new JavaCommand("foo");
+ assertThat(command.getJavaOptions()).isEmpty();
+
+ command.addJavaOptions("");
+ assertThat(command.getJavaOptions()).isEmpty();
+
command.addJavaOptions("-Xmx512m -Xms256m -Dfoo");
assertThat(command.getJavaOptions()).containsOnly("-Xmx512m", "-Xms256m", "-Dfoo");
}