diff options
Diffstat (limited to 'common/src/main')
5 files changed, 16 insertions, 6 deletions
diff --git a/common/src/main/java/org/onap/so/logger/ErrorCode.java b/common/src/main/java/org/onap/so/logger/ErrorCode.java index 7fb9522b7c..a57ed99f2b 100644 --- a/common/src/main/java/org/onap/so/logger/ErrorCode.java +++ b/common/src/main/java/org/onap/so/logger/ErrorCode.java @@ -25,7 +25,7 @@ public enum ErrorCode { AvailabilityError(200), DataError(300), SchemaError(400), - BusinessProcesssError(500), + BusinessProcessError(500), UnknownError(900); private int value; diff --git a/common/src/main/java/org/onap/so/logger/ScheduledTasksMDCSetup.java b/common/src/main/java/org/onap/so/logger/ScheduledTasksMDCSetup.java index 6a20932666..41c4b4bfae 100644 --- a/common/src/main/java/org/onap/so/logger/ScheduledTasksMDCSetup.java +++ b/common/src/main/java/org/onap/so/logger/ScheduledTasksMDCSetup.java @@ -50,7 +50,7 @@ public class ScheduledTasksMDCSetup extends MDCSetup { } public void errorMDCSetup(ErrorCode errorCode, String errorDescription) { - MDC.put(ONAPLogConstants.MDCs.ERROR_CODE, errorCode.toString()); + MDC.put(ONAPLogConstants.MDCs.ERROR_CODE, String.valueOf(errorCode.getValue())); MDC.put(ONAPLogConstants.MDCs.ERROR_DESC, errorDescription); } diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestError.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestError.java index 121fd4a1a5..33678b336f 100644 --- a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestError.java +++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestError.java @@ -33,7 +33,12 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import org.apache.commons.lang3.builder.ToStringBuilder; -import com.fasterxml.jackson.annotation.JsonRootName; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeInfo.As; +import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; +import com.fasterxml.jackson.annotation.JsonTypeName; /** @@ -63,7 +68,9 @@ import com.fasterxml.jackson.annotation.JsonRootName; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = {"policyException", "serviceException"}) @XmlRootElement(name = "requestError") -@JsonRootName(value = "requestError") +@JsonTypeName("requestError") +@JsonTypeInfo(include = As.WRAPPER_OBJECT, use = Id.NAME) +@JsonInclude(Include.NON_NULL) public class RequestError { protected PolicyException policyException; diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceException.java b/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceException.java index f2976136e9..cbbc7f61c1 100644 --- a/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceException.java +++ b/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceException.java @@ -31,6 +31,8 @@ package org.onap.so.serviceinstancebeans; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonRootName; @@ -55,6 +57,7 @@ import com.fasterxml.jackson.annotation.JsonRootName; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "serviceException") @JsonRootName(value = "serviceException") +@JsonInclude(Include.NON_EMPTY) public class ServiceException extends ExceptionType { diff --git a/common/src/main/java/org/onap/so/utils/CryptoUtils.java b/common/src/main/java/org/onap/so/utils/CryptoUtils.java index 640660e97c..ff69e3e4b1 100644 --- a/common/src/main/java/org/onap/so/utils/CryptoUtils.java +++ b/common/src/main/java/org/onap/so/utils/CryptoUtils.java @@ -91,7 +91,7 @@ public final class CryptoUtils { return CryptoUtils.encrypt(message, CLOUD_KEY); } catch (GeneralSecurityException e) { logger.error(LoggingAnchor.THREE, MessageEnum.RA_GENERAL_EXCEPTION.toString(), - ErrorCode.BusinessProcesssError.getValue(), "Exception in encryptPassword ", e); + ErrorCode.BusinessProcessError.getValue(), "Exception in encryptPassword ", e); return null; } } @@ -101,7 +101,7 @@ public final class CryptoUtils { return CryptoUtils.decrypt(message, CLOUD_KEY); } catch (GeneralSecurityException e) { logger.error(LoggingAnchor.THREE, MessageEnum.RA_GENERAL_EXCEPTION.toString(), - ErrorCode.BusinessProcesssError.getValue(), "Exception in encryptPassword ", e); + ErrorCode.BusinessProcessError.getValue(), "Exception in encryptPassword ", e); return null; } } |