diff options
5 files changed, 2 insertions, 16 deletions
diff --git a/src/main/java/org/sonarsource/scanner/cli/Cli.java b/src/main/java/org/sonarsource/scanner/cli/Cli.java index cdada21..1dddb0d 100644 --- a/src/main/java/org/sonarsource/scanner/cli/Cli.java +++ b/src/main/java/org/sonarsource/scanner/cli/Cli.java @@ -69,7 +69,6 @@ class Cli { props.setProperty("sonar.verbose", "true"); debugEnabled = true; logger.setDebugEnabled(true); - logger.setDisplayStackTrace(true); } else if ("-D".equals(arg) || "--define".equals(arg)) { i++; diff --git a/src/main/java/org/sonarsource/scanner/cli/Logs.java b/src/main/java/org/sonarsource/scanner/cli/Logs.java index c86decf..a26a850 100644 --- a/src/main/java/org/sonarsource/scanner/cli/Logs.java +++ b/src/main/java/org/sonarsource/scanner/cli/Logs.java @@ -26,7 +26,6 @@ import java.time.format.DateTimeFormatter; public class Logs { private DateTimeFormatter timeFormatter; private boolean debugEnabled = false; - private boolean displayStackTrace = false; private PrintStream stdOut; private PrintStream stdErr; @@ -40,10 +39,6 @@ public class Logs { this.debugEnabled = debugEnabled; } - public void setDisplayStackTrace(boolean displayStackTrace) { - this.displayStackTrace = displayStackTrace; - } - public boolean isDebugEnabled() { return debugEnabled; } @@ -70,7 +65,7 @@ public class Logs { public void error(String message, Throwable t) { print(stdErr, "ERROR: " + message); - if (t != null && displayStackTrace) { + if (t != null) { t.printStackTrace(stdErr); } } diff --git a/src/main/java/org/sonarsource/scanner/cli/Main.java b/src/main/java/org/sonarsource/scanner/cli/Main.java index 83bdf33..f825034 100644 --- a/src/main/java/org/sonarsource/scanner/cli/Main.java +++ b/src/main/java/org/sonarsource/scanner/cli/Main.java @@ -103,7 +103,6 @@ public class Main { || "DEBUG".equalsIgnoreCase(props.getProperty("sonar.log.level")) || "TRACE".equalsIgnoreCase(props.getProperty("sonar.log.level"))) { logger.setDebugEnabled(true); - logger.setDisplayStackTrace(true); } } diff --git a/src/test/java/org/sonarsource/scanner/cli/LogsTest.java b/src/test/java/org/sonarsource/scanner/cli/LogsTest.java index bda9d28..d688982 100644 --- a/src/test/java/org/sonarsource/scanner/cli/LogsTest.java +++ b/src/test/java/org/sonarsource/scanner/cli/LogsTest.java @@ -70,18 +70,12 @@ public class LogsTest { @Test public void testError() { Exception e = new NullPointerException("exception"); - logs.setDisplayStackTrace(false); logs.error("error1"); verify(stdErr).println("ERROR: error1"); logs.error("error2", e); verify(stdErr).println("ERROR: error2"); - - verifyNoMoreInteractions(stdOut, stdErr); - - logs.setDisplayStackTrace(true); - logs.error("error3", e); - verify(stdErr).println("ERROR: error3"); + verify(stdErr).println(e); // other interactions to print the exception.. } diff --git a/src/test/java/org/sonarsource/scanner/cli/MainTest.java b/src/test/java/org/sonarsource/scanner/cli/MainTest.java index 7efc17a..3484aef 100644 --- a/src/test/java/org/sonarsource/scanner/cli/MainTest.java +++ b/src/test/java/org/sonarsource/scanner/cli/MainTest.java @@ -220,7 +220,6 @@ public class MainTest { // Logger used for callback should have debug enabled verify(logs).setDebugEnabled(true); - verify(logs).setDisplayStackTrace(true); ArgumentCaptor<Properties> propertiesCapture = ArgumentCaptor.forClass(Properties.class); verify(runner).runAnalysis(propertiesCapture.capture()); |