import org.apache.commons.io.IOUtils;
+import javax.annotation.Nullable;
+
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
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;
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;
}
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 {
private static final String[] LESS_THAN_3_7 = {"0", "1", "2", "3.0", "3.1", "3.2", "3.3", "3.4", "3.5", "3.6"};
+ private VersionUtils() {
+ }
+
static boolean isLessThan37(String version) {
return inVersions(version, LESS_THAN_3_7);
}