aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/sonarsource/scanner/cli
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2016-09-16 15:21:00 +0200
committerDuarte Meneses <duarte.meneses@sonarsource.com>2016-09-16 15:21:00 +0200
commit00e8ca4b08e25f0db409d90a56113a0d0907fdf0 (patch)
tree6a540a50def5646bbe6b02b4a09848b08c954af3 /src/main/java/org/sonarsource/scanner/cli
parent85c24bd5fe1485a43342e69058263aa48a51378d (diff)
downloadsonar-scanner-cli-00e8ca4b08e25f0db409d90a56113a0d0907fdf0.tar.gz
sonar-scanner-cli-00e8ca4b08e25f0db409d90a56113a0d0907fdf0.zip
SQSCANNER-23 Support the new 'MessageException' unchecked exception and log by default the error stack trace only when a non-MessageException is thrown
Diffstat (limited to 'src/main/java/org/sonarsource/scanner/cli')
-rw-r--r--src/main/java/org/sonarsource/scanner/cli/Main.java24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/main/java/org/sonarsource/scanner/cli/Main.java b/src/main/java/org/sonarsource/scanner/cli/Main.java
index b8b6e68..83bdf33 100644
--- a/src/main/java/org/sonarsource/scanner/cli/Main.java
+++ b/src/main/java/org/sonarsource/scanner/cli/Main.java
@@ -81,7 +81,7 @@ public class Main {
runner.stop();
exit.exit(Exit.SUCCESS);
}
-
+
private void checkSkip(Properties properties) {
if ("true".equalsIgnoreCase(properties.getProperty(ScanProperties.SKIP))) {
logger.info("SonarQube Scanner analysis skipped");
@@ -125,27 +125,25 @@ public class Main {
logger.error(message, e);
} else {
logger.error(message);
- if (e != null) {
- logger.error(e.getMessage());
- String previousMsg = "";
- for (Throwable cause = e.getCause(); cause != null
- && cause.getMessage() != null
- && !cause.getMessage().equals(previousMsg); cause = cause.getCause()) {
- logger.error("Caused by: " + cause.getMessage());
- previousMsg = cause.getMessage();
- }
+ logger.error(e.getMessage());
+ String previousMsg = "";
+ for (Throwable cause = e.getCause(); cause != null
+ && cause.getMessage() != null
+ && !cause.getMessage().equals(previousMsg); cause = cause.getCause()) {
+ logger.error("Caused by: " + cause.getMessage());
+ previousMsg = cause.getMessage();
}
}
-
+
if (!cli.isDebugEnabled()) {
logger.error("");
suggestDebugMode();
}
}
-
+
private static boolean showStackTrace(Throwable e, boolean debug) {
// class not available at compile time (loaded by isolated classloader)
- return debug || "org.sonar.api.utils.MessageException".equals(e.getClass().getName());
+ return debug || !"org.sonar.api.utils.MessageException".equals(e.getClass().getName());
}
private void suggestDebugMode() {