aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephane Gamard <stephane.gamard@searchbox.com>2014-07-10 23:59:49 +0200
committerStephane Gamard <stephane.gamard@searchbox.com>2014-07-10 23:59:49 +0200
commitd6ef9a9ab4f0c9f9f24483e18afd032af9225010 (patch)
tree725dda1483335ea2855e518d9c0e2da8516b984a
parentc18ceffbdcd09605eaf3cfc02c4f5f103cfa7f24 (diff)
downloadsonarqube-d6ef9a9ab4f0c9f9f24483e18afd032af9225010.tar.gz
sonarqube-d6ef9a9ab4f0c9f9f24483e18afd032af9225010.zip
SONAR-4898 - Fixed Env definition for start.jar
-rw-r--r--server/sonar-process/src/main/java/org/sonar/process/ProcessWrapper.java6
-rw-r--r--sonar-start/src/main/java/org/sonar/start/Env.java20
-rw-r--r--sonar-start/src/main/java/org/sonar/start/StartServer.java3
3 files changed, 12 insertions, 17 deletions
diff --git a/server/sonar-process/src/main/java/org/sonar/process/ProcessWrapper.java b/server/sonar-process/src/main/java/org/sonar/process/ProcessWrapper.java
index bede6c723dc..f869ab08f78 100644
--- a/server/sonar-process/src/main/java/org/sonar/process/ProcessWrapper.java
+++ b/server/sonar-process/src/main/java/org/sonar/process/ProcessWrapper.java
@@ -59,8 +59,8 @@ public class ProcessWrapper extends Thread {
try {
process = processBuilder.start();
- StreamGobbler errorGobbler = new StreamGobbler(process.getErrorStream(), "ERROR");
- StreamGobbler outputGobbler = new StreamGobbler(process.getInputStream(), "OUTPUT");
+ StreamGobbler errorGobbler = new StreamGobbler(process.getErrorStream(), this.getName()+"-ERROR");
+ StreamGobbler outputGobbler = new StreamGobbler(process.getInputStream(), this.getName());
outputGobbler.start();
errorGobbler.start();
while (!currentThread().isInterrupted()) {
@@ -93,7 +93,7 @@ public class ProcessWrapper extends Thread {
BufferedReader br = new BufferedReader(isr);
String line = null;
while ((line = br.readLine()) != null)
- System.out.println(type + "> " + line);
+ System.out.println(type + " > " + line);
} catch (IOException ioe) {
ioe.printStackTrace();
}
diff --git a/sonar-start/src/main/java/org/sonar/start/Env.java b/sonar-start/src/main/java/org/sonar/start/Env.java
index eb3670bfc57..51a6592ad69 100644
--- a/sonar-start/src/main/java/org/sonar/start/Env.java
+++ b/sonar-start/src/main/java/org/sonar/start/Env.java
@@ -24,27 +24,21 @@ import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
-import java.net.URL;
class Env {
- static final String ERROR_MESSAGE = "Do not copy-paste the configuration files (conf directory) from the old version. Update the content of the new files instead.";
- private final File confFile;
+ private static final String CONF_DIRECTORY = "/conf";
- // visible for testing
- Env(URL confUrl) throws URISyntaxException {
- if (confUrl == null) {
- throw new IllegalStateException(ERROR_MESSAGE);
- }
- this.confFile = new File(confUrl.toURI());
- }
+ private final File confFile;
+ private final File homeDir;
- Env() throws URISyntaxException {
- this(Env.class.getResource("/sonar.properties"));
+ public Env(File homeDir) throws URISyntaxException {
+ this.homeDir = homeDir;
+ this.confFile = new File(CONF_DIRECTORY+"/sonar.properties");
}
File rootDir() {
- return confFile.getParentFile().getParentFile();
+ return homeDir;
}
File file(String relativePath) {
diff --git a/sonar-start/src/main/java/org/sonar/start/StartServer.java b/sonar-start/src/main/java/org/sonar/start/StartServer.java
index 6fd449d72d2..937065c48a7 100644
--- a/sonar-start/src/main/java/org/sonar/start/StartServer.java
+++ b/sonar-start/src/main/java/org/sonar/start/StartServer.java
@@ -28,6 +28,7 @@ import org.sonar.process.ProcessWrapper;
import java.io.IOException;
import java.net.DatagramSocket;
import java.net.URISyntaxException;
+import java.nio.file.Paths;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
@@ -92,6 +93,6 @@ public final class StartServer {
}
public static void main(String... args) throws InterruptedException, IOException, URISyntaxException {
- new StartServer(new Env()).start();
+ new StartServer(new Env(Paths.get(".").toFile())).start();
}
} \ No newline at end of file