aboutsummaryrefslogtreecommitdiffstats
path: root/tools/tools-common/src/main/java
diff options
context:
space:
mode:
authorramverma <ram.krishna.verma@ericsson.com>2018-08-02 12:50:09 +0100
committerramverma <ram.krishna.verma@ericsson.com>2018-08-02 12:50:35 +0100
commite4da736f34d7f1fc91fb1370d29f927a9e2ebe2d (patch)
treeeb8bdb7dfec67512a38e373d0ae16c2a5a103f73 /tools/tools-common/src/main/java
parent9e318f20f2e64970bf3c2e3a5532c516231a6f8a (diff)
Fixing sonar vulnerabilities in apex-pdp
Changed the Console class to use logger only for printing stack trace, as the class is meant to be used for CLI usage. Changed the CLIParser to use Console class for printing messages. Changed the client-editor to be hosted on localhost by default, to follow the same what others clients (deployment, monitoring & client full) are doing. Change-Id: I6565b4b35a93b3708b926bfee04d79ead6b5346e Issue-ID: POLICY-954 Signed-off-by: ramverma <ram.krishna.verma@ericsson.com>
Diffstat (limited to 'tools/tools-common/src/main/java')
-rw-r--r--tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/CliParser.java4
-rw-r--r--tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/Console.java9
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);
}
}