aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-runner-api/src/main
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2013-06-28 15:37:12 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2013-06-28 15:37:12 +0200
commitf127612b203c1664d6eadd6a9e21158c7251f1e4 (patch)
treef6913afb30601df07c48c1ead2c8703f3e6769d0 /sonar-runner-api/src/main
parenta91b3c40a2822b8ef4eace4c92895030b16574ef (diff)
downloadsonar-scanner-cli-f127612b203c1664d6eadd6a9e21158c7251f1e4.tar.gz
sonar-scanner-cli-f127612b203c1664d6eadd6a9e21158c7251f1e4.zip
Fix some quality flaws
Diffstat (limited to 'sonar-runner-api/src/main')
-rw-r--r--sonar-runner-api/src/main/java/org/sonar/runner/api/CommandExecutor.java4
-rw-r--r--sonar-runner-api/src/main/java/org/sonar/runner/api/ForkedRunner.java4
2 files changed, 5 insertions, 3 deletions
diff --git a/sonar-runner-api/src/main/java/org/sonar/runner/api/CommandExecutor.java b/sonar-runner-api/src/main/java/org/sonar/runner/api/CommandExecutor.java
index 801c485..f54dbb9 100644
--- a/sonar-runner-api/src/main/java/org/sonar/runner/api/CommandExecutor.java
+++ b/sonar-runner-api/src/main/java/org/sonar/runner/api/CommandExecutor.java
@@ -21,6 +21,8 @@ package org.sonar.runner.api;
import org.apache.commons.io.IOUtils;
+import javax.annotation.Nullable;
+
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
@@ -50,7 +52,7 @@ class CommandExecutor {
return INSTANCE;
}
- int execute(Command command, StreamConsumer stdOut, StreamConsumer stdErr, long timeoutMilliseconds, ProcessMonitor processMonitor) {
+ int execute(Command command, StreamConsumer stdOut, StreamConsumer stdErr, long timeoutMilliseconds, @Nullable ProcessMonitor processMonitor) {
ExecutorService executorService = null;
Process process = null;
StreamGobbler outputGobbler = null;
diff --git a/sonar-runner-api/src/main/java/org/sonar/runner/api/ForkedRunner.java b/sonar-runner-api/src/main/java/org/sonar/runner/api/ForkedRunner.java
index d5e28f9..6dbb4bc 100644
--- a/sonar-runner-api/src/main/java/org/sonar/runner/api/ForkedRunner.java
+++ b/sonar-runner-api/src/main/java/org/sonar/runner/api/ForkedRunner.java
@@ -53,7 +53,7 @@ public class ForkedRunner extends Runner<ForkedRunner> {
private ProcessMonitor processMonitor;
- ForkedRunner(JarExtractor jarExtractor, CommandExecutor commandExecutor, ProcessMonitor processMonitor) {
+ ForkedRunner(JarExtractor jarExtractor, CommandExecutor commandExecutor, @Nullable ProcessMonitor processMonitor) {
this.jarExtractor = jarExtractor;
this.commandExecutor = commandExecutor;
this.processMonitor = processMonitor;
@@ -192,7 +192,7 @@ public class ForkedRunner extends Runner<ForkedRunner> {
}
int status = commandExecutor.execute(forkCommand.command, stdOut, stdErr, ONE_DAY_IN_MILLISECONDS, processMonitor);
if (status != 0) {
- if (processMonitor.stop()) {
+ if (processMonitor != null && processMonitor.stop()) {
stdOut.consumeLine(String.format("SonarQube Runner was stopped [status=%s]", status));
}
else {