diff options
author | Jorge Hernandez <jh1730@att.com> | 2018-08-02 23:49:47 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-08-02 23:49:47 +0000 |
commit | 0f0f41071ae3c6c7896c7770b0139c9c40866330 (patch) | |
tree | 42886ab2c03407ab7fb9b646ac18ea2cfdfc18bc /tools | |
parent | af74a6270d6ab6badf04a97495a6ef8ccded9b4b (diff) | |
parent | e4da736f34d7f1fc91fb1370d29f927a9e2ebe2d (diff) |
Merge "Fixing sonar vulnerabilities in apex-pdp"
Diffstat (limited to 'tools')
-rw-r--r-- | tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/CliParser.java | 4 | ||||
-rw-r--r-- | tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/Console.java | 9 |
2 files changed, 7 insertions, 6 deletions
diff --git a/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/CliParser.java b/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/CliParser.java index 588abfc6b..31692dc21 100644 --- a/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/CliParser.java +++ b/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/CliParser.java @@ -81,8 +81,8 @@ public class CliParser { try { cmd = parser.parse(options, args); } catch (final ParseException ex) { - System.err.println("Parsing failed. Reason: " + ex.getMessage()); - ex.printStackTrace(); + Console.CONSOLE.error("Parsing failed, see reason and cause below"); + Console.CONSOLE.stacktrace(ex); } return cmd; } diff --git a/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/Console.java b/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/Console.java index 571333147..d76caa333 100644 --- a/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/Console.java +++ b/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/Console.java @@ -25,6 +25,7 @@ import java.util.List; import org.apache.commons.lang3.StringUtils; import org.apache.commons.text.StrBuilder; +import org.slf4j.ext.XLoggerFactory; import org.slf4j.helpers.MessageFormatter; /** @@ -326,12 +327,12 @@ public final class Console { if (appName != null) { System.err.print(appName + ": "); } - System.err.println("exception stack trace: "); - System.err.println(" - message: " + exception.getMessage()); + System.err.println(" exception message: " + exception.getMessage()); if (exception.getCause() != null) { - System.err.println(" - cause: " + exception.getCause()); + System.err.println(" exception cause: " + exception.getCause()); } - exception.printStackTrace(); + System.err.println("for exception stack trace, please refer logs."); + XLoggerFactory.getXLogger(Console.class).error("stacktrace", exception); } } |