diff options
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/sonar/runner/Bootstrapper.java | 4 | ||||
-rw-r--r-- | src/main/java/org/sonar/runner/Logs.java | 6 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/main/java/org/sonar/runner/Bootstrapper.java b/src/main/java/org/sonar/runner/Bootstrapper.java index 63fdad5..d201f47 100644 --- a/src/main/java/org/sonar/runner/Bootstrapper.java +++ b/src/main/java/org/sonar/runner/Bootstrapper.java @@ -25,6 +25,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; +import java.net.ConnectException; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; @@ -74,6 +75,9 @@ class Bootstrapper { if (serverVersion == null) { try { serverVersion = remoteContent(VERSION_PATH); + } catch (ConnectException e) { + Logs.error("Sonar server '" + serverUrl + "' can not be reached"); + throw new IllegalStateException("Fail to request server version", e); } catch (IOException e) { throw new IllegalStateException("Fail to request server version", e); } diff --git a/src/main/java/org/sonar/runner/Logs.java b/src/main/java/org/sonar/runner/Logs.java index b0ad8c0..3ce1cca 100644 --- a/src/main/java/org/sonar/runner/Logs.java +++ b/src/main/java/org/sonar/runner/Logs.java @@ -24,6 +24,10 @@ final class Logs { } static void info(String message) { - System.out.println(message); // NOSONAR + System.out.println(message); + } + + static void error(String message) { + System.err.println("ERROR: " + message); } } |