aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2017-01-13 11:36:34 +0100
committerJulien HENRY <henryju@yahoo.fr>2017-01-13 11:58:22 +0100
commit25b8af28ff4636a8222cc65af59200ac7140ff67 (patch)
tree3325bd762659df6d3472a8e37e88ddfce1800340 /src/main
parentae19303ed23f5120e228a4f7cdfb4ebe383abbd5 (diff)
downloadsonar-scanner-cli-25b8af28ff4636a8222cc65af59200ac7140ff67.tar.gz
sonar-scanner-cli-25b8af28ff4636a8222cc65af59200ac7140ff67.zip
SQSCANNER-36 Don't loose error message in case of low level error (like OOM)
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/sonarsource/scanner/cli/Main.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/org/sonarsource/scanner/cli/Main.java b/src/main/java/org/sonarsource/scanner/cli/Main.java
index 8d030e4..a273381 100644
--- a/src/main/java/org/sonarsource/scanner/cli/Main.java
+++ b/src/main/java/org/sonarsource/scanner/cli/Main.java
@@ -65,22 +65,26 @@ public class Main {
Stats stats = new Stats(logger).start();
int status = Exit.ERROR;
+ boolean started = false;
try {
Properties p = conf.properties();
checkSkip(p);
configureLogging(p);
init(p);
runner.start();
+ started = true;
logger.info("SonarQube server " + runner.serverVersion());
runAnalysis(stats, p);
status = Exit.SUCCESS;
- } catch (Exception e) {
+ } catch (Throwable e) {
status = Exit.ERROR;
displayExecutionResult(stats, "FAILURE");
showError("Error during SonarQube Scanner execution", e, cli.isDebugEnabled());
} finally {
try {
- runner.stop();
+ if (started) {
+ runner.stop();
+ }
} catch (Throwable e) {
status = Exit.ERROR;
logger.error("Unable to properly stop the scanner", e);