From 734a8fd191953cefc30d6c94273ead9d4cd84846 Mon Sep 17 00:00:00 2001 From: Kanagaraj Manickam k00365106 Date: Wed, 25 Apr 2018 12:30:52 +0530 Subject: Following guideline while placing the constructor Issue-ID: CLI-100 Change-Id: I29980de174127f21f52b46dee0369bb7c43ba4da Signed-off-by: Kanagaraj Manickam k00365106 --- .../onap/cli/fw/error/OnapCommandException.java | 32 +++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) 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 e83f8574..27de7b7d 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 @@ -80,22 +80,6 @@ public class OnapCommandException extends Exception { this(errorCode, errorMessage, -1); } - @Override - public String getMessage() { - String message = this.errorCode + "::" + this.errorMessage; - if (this.httpStatusCode != -1) { - message = this.httpStatusCode + "::" + message; - } - - return message; - } - - public String toJsonString() { - return "{\""+ OnapCommandConstants.ERROR + "\": {\""+ - OnapCommandConstants.ERROR_CODE + "\": \"" + this.errorCode + "\", \""+ - OnapCommandConstants.ERROR_MESSAGE + "\": \"" + this.errorMessage + "\"}}"; - } - public OnapCommandException(String errorCode, String errorMessage, Throwable e) { this(errorCode, errorMessage + ", " + e.getMessage()); log.error(this.getMessage(), e); @@ -116,6 +100,22 @@ public class OnapCommandException extends Exception { log.error(this.getMessage(), e); } + @Override + public String getMessage() { + String message = this.errorCode + "::" + this.errorMessage; + if (this.httpStatusCode != -1) { + message = this.httpStatusCode + "::" + message; + } + + return message; + } + + public String toJsonString() { + return "{\""+ OnapCommandConstants.ERROR + "\": {\""+ + OnapCommandConstants.ERROR_CODE + "\": \"" + this.errorCode + "\", \""+ + OnapCommandConstants.ERROR_MESSAGE + "\": \"" + this.errorMessage + "\"}}"; + } + public String getErrorCode() { return this.errorCode; } -- cgit 1.2.3-korg