summaryrefslogtreecommitdiffstats
path: root/framework/src/main
diff options
context:
space:
mode:
authorKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2017-09-29 17:17:31 +0530
committerKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2017-09-29 17:17:31 +0530
commit3d11865921346189147f02eab887b7acc2dbd843 (patch)
treea913cf2d30c09e7b62209e60a638c07e5ae1a0d2 /framework/src/main
parent789552ac35830642855c6a5d6c16afa3c4eed109 (diff)
Enable exception to get traced
CLI-2 Change-Id: Ib16490d6800a07d69c995f2301d34bebf3f78c28 Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Diffstat (limited to 'framework/src/main')
-rw-r--r--framework/src/main/java/org/onap/cli/fw/OnapCommandRegistrar.java4
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandClientInitialzationFailed.java6
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandDiscoveryFailed.java4
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandException.java28
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandExecutionFailed.java14
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandHelpFailed.java7
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandHttpFailure.java10
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandHttpInvalidResponseBody.java7
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidParameterValue.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidSchema.java10
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandLoadProfileFailed.java7
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandLoginFailed.java8
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandLogoutFailed.java6
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandOutputPrintingFailed.java8
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandPersistProfileFailed.java10
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandRegistrationFailed.java8
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandResultInitialzationFailed.java8
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandResultMapProcessingFailed.java8
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandSchemaNotFound.java8
-rw-r--r--framework/src/main/resources/onap.properties1
20 files changed, 115 insertions, 49 deletions
diff --git a/framework/src/main/java/org/onap/cli/fw/OnapCommandRegistrar.java b/framework/src/main/java/org/onap/cli/fw/OnapCommandRegistrar.java
index 72e22b51..e26a29af 100644
--- a/framework/src/main/java/org/onap/cli/fw/OnapCommandRegistrar.java
+++ b/framework/src/main/java/org/onap/cli/fw/OnapCommandRegistrar.java
@@ -42,6 +42,8 @@ import org.onap.cli.fw.output.PrintDirection;
import org.onap.cli.fw.output.ResultType;
import org.onap.cli.fw.utils.ExternalSchema;
import org.onap.cli.fw.utils.OnapCommandUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Onap Command registrar provides a common place, where every command would get registered automatically when its
@@ -50,6 +52,8 @@ import org.onap.cli.fw.utils.OnapCommandUtils;
*/
public class OnapCommandRegistrar {
+ private static Logger LOG = LoggerFactory.getLogger(OnapCommandRegistrar.class);
+
private Map<String, Class<? extends OnapCommand>> registry = new HashMap<>();
private Set<String> availableProductVersions = new HashSet<>();
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandClientInitialzationFailed.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandClientInitialzationFailed.java
index be88d18a..d4fff5b7 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandClientInitialzationFailed.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandClientInitialzationFailed.java
@@ -25,13 +25,13 @@ public class OnapCommandClientInitialzationFailed extends OnapCommandException {
private static final long serialVersionUID = 8580121615330415000L;
private static final String ERROR_CODE = "0x0021";
private static final String ERROR_MESSAGE1 = "API client for the command ";
- private static final String ERROR_MESSAGE2 = " is failed, ";
+ private static final String ERROR_MESSAGE2 = " is failed";
public OnapCommandClientInitialzationFailed(String cmd, String error) {
- super(ERROR_CODE, ERROR_MESSAGE1 + cmd + ERROR_MESSAGE2 + error);
+ super(ERROR_CODE, ERROR_MESSAGE1 + cmd + ERROR_MESSAGE2 + ", " + error);
}
public OnapCommandClientInitialzationFailed(String cmd, Throwable throwable) {
- this(cmd, throwable.getMessage());
+ super(ERROR_CODE, ERROR_MESSAGE1 + cmd + ERROR_MESSAGE2, throwable);
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandDiscoveryFailed.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandDiscoveryFailed.java
index 582e4cfc..87d1f4d6 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandDiscoveryFailed.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandDiscoveryFailed.java
@@ -35,10 +35,10 @@ public class OnapCommandDiscoveryFailed extends OnapCommandException {
}
public OnapCommandDiscoveryFailed(String directory, String fileName) {
- this(directory, fileName, new Exception(""));
+ super(ERROR_CODE, ERROR_MESSAGE4 + fileName + ERROR_MESSAGE3 + directory + "'");
}
public OnapCommandDiscoveryFailed(String directory, String fileName, Throwable throwable) {
- super(ERROR_CODE, ERROR_MESSAGE4 + fileName + ERROR_MESSAGE3 + directory + "' , " + throwable.getMessage());
+ super(ERROR_CODE, ERROR_MESSAGE4 + fileName + ERROR_MESSAGE3 + directory + "'", throwable);
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandException.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandException.java
index 3ef1b400..905b17bc 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandException.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandException.java
@@ -16,6 +16,9 @@
package org.onap.cli.fw.error;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* Base command exception.
*
@@ -24,6 +27,8 @@ public class OnapCommandException extends Exception {
private static final long serialVersionUID = 2833124031431731711L;
+ private static Logger LOG = LoggerFactory.getLogger(OnapCommandException.class);
+
/*
* Command Error Code
*/
@@ -70,4 +75,27 @@ public class OnapCommandException extends Exception {
return message;
}
+ public OnapCommandException(String errorCode, String errorMessage, Throwable e) {
+ this(errorCode, errorMessage + ", " + e.getMessage());
+ LOG.error(this.getMessage(), e);
+ }
+
+ public OnapCommandException(String errorCode, String errorMessage, Throwable e, long httpStatusCode) {
+ this(errorCode, errorMessage + ", " + e.getMessage(), httpStatusCode);
+ LOG.error(this.getMessage(), e);
+ }
+
+ public OnapCommandException(String errorCode, Throwable e, long httpStatusCode) {
+ this(errorCode, e.getMessage(), httpStatusCode);
+ LOG.error(this.getMessage(), e);
+ }
+
+ public OnapCommandException(String errorCode, Throwable e) {
+ this(errorCode, e.getMessage(), -1);
+ LOG.error(this.getMessage(), e);
+ }
+
+ public String getErrorCode() {
+ return this.errorCode;
+ }
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandExecutionFailed.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandExecutionFailed.java
index 22d11acb..2117cec7 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandExecutionFailed.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandExecutionFailed.java
@@ -25,15 +25,15 @@ public class OnapCommandExecutionFailed extends OnapCommandException {
private static final String ERROR_CODE = "0x0001";
private static final String ERROR_MESSAGE1 = "Command ";
- private static final String ERROR_MESSAGE2 = " failed to execute, ";
- private static final String ERROR_MESSAGE3 = "Failed to retrive service url, ";
+ private static final String ERROR_MESSAGE2 = " failed to execute";
+ private static final String ERROR_MESSAGE3 = "Failed to retrive service url";
public OnapCommandExecutionFailed(String cmdName, String error, long httpStatus) {
- super(ERROR_CODE, ERROR_MESSAGE1 + cmdName + ERROR_MESSAGE2 + error, httpStatus);
+ super(ERROR_CODE, ERROR_MESSAGE1 + cmdName + ERROR_MESSAGE2 + ", " + error, httpStatus);
}
public OnapCommandExecutionFailed(String cmdName, Throwable throwable, long httpStatus) {
- this(cmdName,throwable.getMessage(),httpStatus);
+ super(ERROR_CODE, ERROR_MESSAGE1 + cmdName + ERROR_MESSAGE2 ,throwable, httpStatus);
}
public OnapCommandExecutionFailed(String error) {
@@ -41,15 +41,15 @@ public class OnapCommandExecutionFailed extends OnapCommandException {
}
public OnapCommandExecutionFailed(Throwable throwable, String details) {
- this(ERROR_MESSAGE3 + details + ", " + throwable.getMessage());
+ super(ERROR_CODE, ERROR_MESSAGE3 + ", " +details, throwable);
}
public OnapCommandExecutionFailed(String cmdName, String error) {
- super(ERROR_CODE, ERROR_MESSAGE1 + cmdName + ERROR_MESSAGE2 + error);
+ super(ERROR_CODE, ERROR_MESSAGE1 + cmdName + ERROR_MESSAGE2 + ", " + error);
}
public OnapCommandExecutionFailed(String cmd, Throwable throwable) {
- this(cmd , throwable.getMessage());
+ super(ERROR_CODE, ERROR_MESSAGE1 + cmd + ERROR_MESSAGE2 , throwable);
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandHelpFailed.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandHelpFailed.java
index 12e711e3..a2efcca5 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandHelpFailed.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandHelpFailed.java
@@ -23,6 +23,9 @@ package org.onap.cli.fw.error;
public class OnapCommandHelpFailed extends OnapCommandException {
private static final long serialVersionUID = -1833571383961748518L;
+ private static final String ERROR_CODE = "0x0002";
+
+ private static final String ERROR_MSG = "Command failed to print help message";
/**
* Help failed exception.
*
@@ -30,10 +33,10 @@ public class OnapCommandHelpFailed extends OnapCommandException {
* message
*/
public OnapCommandHelpFailed(String error) {
- super("0x0002", "Command failed to print help message, " + error);
+ super(ERROR_CODE, ERROR_MSG + ", " + error);
}
public OnapCommandHelpFailed(Throwable throwable) {
- this(throwable.getMessage());
+ super(ERROR_CODE, ERROR_MSG, throwable);
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandHttpFailure.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandHttpFailure.java
index 80f99695..954e6e11 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandHttpFailure.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandHttpFailure.java
@@ -23,22 +23,22 @@ package org.onap.cli.fw.error;
public class OnapCommandHttpFailure extends OnapCommandException {
private static final long serialVersionUID = 488775545436993345L;
- private static final String ERROR = "0x0025";
+ private static final String ERROR_CODE = "0x0025";
public OnapCommandHttpFailure(String error, long httpStatus) {
- super(ERROR, error, httpStatus);
+ super(ERROR_CODE, error, httpStatus);
}
public OnapCommandHttpFailure(String error) {
- super(ERROR, error);
+ super(ERROR_CODE, error);
}
public OnapCommandHttpFailure(Throwable throwable) {
- this(throwable.getMessage());
+ super(ERROR_CODE, throwable);
}
public OnapCommandHttpFailure(Throwable throwable, long httpStatus) {
- this(throwable.getMessage(), httpStatus);
+ super(ERROR_CODE, throwable, httpStatus);
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandHttpInvalidResponseBody.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandHttpInvalidResponseBody.java
index 1451440a..0cf2ac01 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandHttpInvalidResponseBody.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandHttpInvalidResponseBody.java
@@ -24,11 +24,14 @@ public class OnapCommandHttpInvalidResponseBody extends OnapCommandException {
private static final long serialVersionUID = 6676137916079057963L;
+ private static final String ERROR_CODE = "0x0028";
+ private static final String ERR_MSG = "Http response body does not have json entry ";
+
public OnapCommandHttpInvalidResponseBody(String name, String error) {
- super("0x0028", "Http response body does not have json entry " + name + ", " + error);
+ super(ERROR_CODE, ERR_MSG + name + ", " + error);
}
public OnapCommandHttpInvalidResponseBody(String name, Throwable throwable) {
- this(name, throwable.getMessage());
+ super(ERROR_CODE, ERR_MSG + name, throwable);
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidParameterValue.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidParameterValue.java
index 652789a6..49d41ffc 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidParameterValue.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidParameterValue.java
@@ -29,7 +29,7 @@ public class OnapCommandInvalidParameterValue extends OnapCommandException {
}
public OnapCommandInvalidParameterValue(String paramName, Throwable throwable) {
- super("0x0028", "Parameter " + paramName + " value is invalid, " + throwable.getMessage());
+ super("0x0028", "Parameter " + paramName + " value is invalid", throwable);
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidSchema.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidSchema.java
index 4c05d741..ae705577 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidSchema.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidSchema.java
@@ -24,16 +24,20 @@ public class OnapCommandInvalidSchema extends OnapCommandException {
private static final long serialVersionUID = -3387652326582792833L;
+ private static final String ERROR_CODE = "0x0007";
+
+ private static final String ERROR_MSG = "Invalid command schema ";
+
public OnapCommandInvalidSchema(String error) {
- this("", error);
+ this(ERROR_CODE, error);
}
public OnapCommandInvalidSchema(String schema, String error) {
- super("0x0007", "Command schema " + schema + " is invalid, " + error);
+ super(ERROR_CODE, ERROR_MSG + schema + ", " + error);
}
public OnapCommandInvalidSchema(String schema, Throwable throwable) {
- this(schema, throwable.getMessage());
+ super(ERROR_CODE, ERROR_MSG + schema , throwable);
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandLoadProfileFailed.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandLoadProfileFailed.java
index 0e3846a0..5398cdd5 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandLoadProfileFailed.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandLoadProfileFailed.java
@@ -24,15 +24,18 @@ public class OnapCommandLoadProfileFailed extends OnapCommandException {
private static final long serialVersionUID = 8580121615330415123L;
+ private static final String ERROR_CODE = "0x1301";
+
+ private static final String ERROR_MSG = "Failed to load profile details";
/**
* Command result empty.
*/
public OnapCommandLoadProfileFailed(String error) {
- super("0x1301", "Failed to load profile details, " + error);
+ super(ERROR_CODE, ERROR_MSG + ", " + error);
}
public OnapCommandLoadProfileFailed(Throwable error) {
- this(error.getMessage());
+ super(ERROR_CODE, ERROR_MSG, error);
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandLoginFailed.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandLoginFailed.java
index c2d69bc1..01c5a600 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandLoginFailed.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandLoginFailed.java
@@ -25,17 +25,17 @@ public class OnapCommandLoginFailed extends OnapCommandException {
private static final long serialVersionUID = 5518154493762956959L;
private static final String ERROR_CODE = "0x0009";
- private static final String ERROR_MESSAGE1 = "Login failed, ";
+ private static final String ERROR_MESSAGE1 = "Login failed";
public OnapCommandLoginFailed(String error) {
- super(ERROR_CODE, ERROR_MESSAGE1 + error);
+ super(ERROR_CODE, ERROR_MESSAGE1 + ", " + error);
}
public OnapCommandLoginFailed(String error, int httpStatus) {
- super(ERROR_CODE, ERROR_MESSAGE1 + error, httpStatus);
+ super(ERROR_CODE, ERROR_MESSAGE1 + ", " + error, httpStatus);
}
public OnapCommandLoginFailed(Throwable throwable) {
- this(throwable.getMessage());
+ super(ERROR_CODE, ERROR_MESSAGE1, throwable);
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandLogoutFailed.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandLogoutFailed.java
index 3b415de0..430b65c4 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandLogoutFailed.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandLogoutFailed.java
@@ -24,14 +24,14 @@ public class OnapCommandLogoutFailed extends OnapCommandException {
private static final long serialVersionUID = 1150649507734289032L;
private static final String ERROR_CODE = "0x0010";
- private static final String ERROR_MESSAGE1 = "Logout failed, ";
+ private static final String ERROR_MESSAGE1 = "Logout failed";
public OnapCommandLogoutFailed(String error) {
- super(ERROR_CODE, ERROR_MESSAGE1 + error);
+ super(ERROR_CODE, ERROR_MESSAGE1 +", " + error);
}
public OnapCommandLogoutFailed(Throwable throwable) {
- this(throwable.getMessage());
+ super(ERROR_CODE, ERROR_MESSAGE1, throwable);
}
public OnapCommandLogoutFailed(int statusCode) {
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandOutputPrintingFailed.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandOutputPrintingFailed.java
index 31ee3e0b..b875e00f 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandOutputPrintingFailed.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandOutputPrintingFailed.java
@@ -24,11 +24,15 @@ public class OnapCommandOutputPrintingFailed extends OnapCommandException {
private static final long serialVersionUID = -1957064141442406239L;
+ private static final String ERROR_CODE = "0x0014";
+
+ private static final String ERROR_MSG = "Command is failed to print the result";
+
public OnapCommandOutputPrintingFailed(String error) {
- super("0x0014", "Command is failed to print the result, " + error);
+ super(ERROR_CODE, ERROR_MSG + ", " + error);
}
public OnapCommandOutputPrintingFailed(Throwable throwable) {
- this(throwable.getMessage());
+ super(ERROR_CODE, ERROR_MSG , throwable);
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandPersistProfileFailed.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandPersistProfileFailed.java
index 4e563d51..ce8ea62f 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandPersistProfileFailed.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandPersistProfileFailed.java
@@ -16,8 +16,6 @@
package org.onap.cli.fw.error;
-import java.io.IOException;
-
/**
* Command profile persistence failed.
*
@@ -26,14 +24,18 @@ public class OnapCommandPersistProfileFailed extends OnapCommandException {
private static final long serialVersionUID = 8580121615330415123L;
+ private static final String ERROR_CODE = "0x1302";
+
+ private static final String ERROR_MSG = "Failed to persist profile details";
+
/**
* Command result empty.
*/
public OnapCommandPersistProfileFailed(String error) {
- super("0x1302", "Failed to persist profile details, " + error);
+ super(ERROR_CODE, ERROR_MSG + ", " + error);
}
public OnapCommandPersistProfileFailed(Throwable e1) {
- this(e1.getMessage());
+ super(ERROR_CODE, ERROR_MSG, e1);
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandRegistrationFailed.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandRegistrationFailed.java
index d920f7d0..1a13a293 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandRegistrationFailed.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandRegistrationFailed.java
@@ -24,11 +24,15 @@ public class OnapCommandRegistrationFailed extends OnapCommandException {
private static final long serialVersionUID = 5513297861129088460L;
+ private static final String ERROR_CODE = "0x0018";
+
+ private static final String ERROR_MSG = "Failed to register the command ";
+
public OnapCommandRegistrationFailed(String cmdName, String error) {
- super("0x0018", "Command " + cmdName + " is failed to register, " + error);
+ super(ERROR_CODE, ERROR_MSG + cmdName + ", " + error);
}
public OnapCommandRegistrationFailed(String cmdName, Throwable throwable) {
- this(cmdName, throwable.getMessage());
+ super(ERROR_CODE, ERROR_MSG + cmdName, throwable);
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandResultInitialzationFailed.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandResultInitialzationFailed.java
index 20060531..c32bda88 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandResultInitialzationFailed.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandResultInitialzationFailed.java
@@ -24,11 +24,15 @@ public class OnapCommandResultInitialzationFailed extends OnapCommandException {
private static final long serialVersionUID = 8580121615330415123L;
+ private static final String ERROR_CODE = "0x0022";
+
+ private static final String ERROR_MSG = "Failed to parse the result format of command ";
+
public OnapCommandResultInitialzationFailed(String cmd, String error) {
- super("0x0022", "Command " + cmd + " result format is failed, " + error);
+ super(ERROR_CODE, ERROR_MSG + cmd + ", " + error);
}
public OnapCommandResultInitialzationFailed(String cmd, Throwable throwable) {
- this(cmd, throwable.getMessage());
+ super(ERROR_CODE, ERROR_MSG + cmd , throwable);
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandResultMapProcessingFailed.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandResultMapProcessingFailed.java
index 191ced06..238e9092 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandResultMapProcessingFailed.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandResultMapProcessingFailed.java
@@ -23,13 +23,15 @@ package org.onap.cli.fw.error;
public class OnapCommandResultMapProcessingFailed extends OnapCommandException {
private static final long serialVersionUID = 488775545436113019L;
- private static final String errorCode = "0x0028";
+ private static final String ERROR_CODE = "0x0028";
+
+ private static final String ERROR_MSG = "Failed to parse the result format of command ";
public OnapCommandResultMapProcessingFailed(String resultMap, String error) {
- super(errorCode, "Failed to process the result map " + resultMap + " in http section, " + error);
+ super(ERROR_CODE, ERROR_MSG + resultMap + ", " + error);
}
public OnapCommandResultMapProcessingFailed(String resultMap, Throwable throwable) {
- this(resultMap, throwable.getMessage());
+ super(ERROR_CODE, ERROR_MSG + resultMap, throwable);
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandSchemaNotFound.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandSchemaNotFound.java
index cbd6fa69..42514366 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandSchemaNotFound.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandSchemaNotFound.java
@@ -24,11 +24,15 @@ public class OnapCommandSchemaNotFound extends OnapCommandException {
private static final long serialVersionUID = -3919580583845280200L;
+ private static final String ERROR_CODE = "0x0019";
+
+ private static final String ERROR_MSG = "Command schema is missing for command ";
+
public OnapCommandSchemaNotFound(String cmdName) {
- this(cmdName, new Exception(""));
+ super(ERROR_CODE, ERROR_MSG + cmdName);
}
public OnapCommandSchemaNotFound(String cmdName, Throwable throwable) {
- super("0x0019", "Command schema " + cmdName + " is not found, " + throwable.getMessage());
+ super(ERROR_CODE, ERROR_MSG + cmdName, throwable);
}
}
diff --git a/framework/src/main/resources/onap.properties b/framework/src/main/resources/onap.properties
index 77be05f3..7b04c6a5 100644
--- a/framework/src/main/resources/onap.properties
+++ b/framework/src/main/resources/onap.properties
@@ -2,6 +2,7 @@ cli.ignore_auth=false
cli.version=1.0
cli.http.api_key_use_cookies=true
cli.discover_always=false
+
cli.service_name=onap-cli
cli.api_gateway=msb
cli.auth_service=auth