aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2013-01-17 19:16:20 +0100
committerJulien HENRY <julien.henry@sonarsource.com>2013-01-17 19:16:20 +0100
commit5d5c4140f8f4c2b2c1eea1f7840df7aad6fb5cea (patch)
tree85b5d3086d5d7b4b609b5123022e2919acc24942 /src/main/java/org
parenta10143d0914482a570ef930f2e32279438d1210d (diff)
downloadsonar-scanner-cli-5d5c4140f8f4c2b2c1eea1f7840df7aad6fb5cea.tar.gz
sonar-scanner-cli-5d5c4140f8f4c2b2c1eea1f7840df7aad6fb5cea.zip
SONARPLUGINS-2468 Improve display of errors.
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/sonar/runner/Bootstrapper.java8
-rw-r--r--src/main/java/org/sonar/runner/Main.java6
2 files changed, 11 insertions, 3 deletions
diff --git a/src/main/java/org/sonar/runner/Bootstrapper.java b/src/main/java/org/sonar/runner/Bootstrapper.java
index d201f47..bfe6757 100644
--- a/src/main/java/org/sonar/runner/Bootstrapper.java
+++ b/src/main/java/org/sonar/runner/Bootstrapper.java
@@ -29,6 +29,7 @@ import java.net.ConnectException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
+import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
@@ -77,9 +78,12 @@ class Bootstrapper {
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);
+ throw new RunnerException("Fail to request server version", e);
+ } catch (UnknownHostException e) {
+ Logs.error("Sonar server '" + serverUrl + "' can not be reached");
+ throw new RunnerException("Fail to request server version", e);
} catch (IOException e) {
- throw new IllegalStateException("Fail to request server version", e);
+ throw new RunnerException("Fail to request server version", e);
}
}
return serverVersion;
diff --git a/src/main/java/org/sonar/runner/Main.java b/src/main/java/org/sonar/runner/Main.java
index 90994fb..9cb9d47 100644
--- a/src/main/java/org/sonar/runner/Main.java
+++ b/src/main/java/org/sonar/runner/Main.java
@@ -132,8 +132,12 @@ public final class Main {
Logs.error(message);
if (e != null) {
Logs.error(e.getMessage());
- for (Throwable cause = e.getCause(); cause != null; cause = cause.getCause()) {
+ String previousMsg = "";
+ for (Throwable cause = e.getCause(); cause != null
+ && cause.getMessage() != null
+ && !cause.getMessage().equals(previousMsg); cause = cause.getCause()) {
Logs.error("Caused by: " + cause.getMessage());
+ previousMsg = cause.getMessage();
}
}
Logs.error("");