diff options
author | Parshad Patel <pars.patel@samsung.com> | 2019-08-08 13:10:59 +0900 |
---|---|---|
committer | Parshad Patel <pars.patel@samsung.com> | 2019-08-08 13:12:09 +0900 |
commit | c1d2b0f9c86f8cc019e762900fec723f2a12eb0b (patch) | |
tree | 44edb097e5b930b743fdb314310f3f59e619a3ce /bpmn | |
parent | e468693695de298bf2282508fa00c3a21496524e (diff) |
Fix sonar issues in MSOCoreBPMN
Either log or rethrow this exception
Make "serviceParams" transient or serializable
Make "extSystemErrorSource" transient or serializable
Issue-ID: SO-1841
Change-Id: If752c7898a0934212d425b1c80b8d2ee34098ad3
Signed-off-by: Parshad Patel <pars.patel@samsung.com>
Diffstat (limited to 'bpmn')
3 files changed, 14 insertions, 21 deletions
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java index 7d5bb0dcf1..21847e1c4e 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java @@ -33,7 +33,7 @@ public class WorkflowException implements Serializable { private final int errorCode; private final String errorMessage; private final String workStep; - private TargetEntities extSystemErrorSource; + private transient TargetEntities extSystemErrorSource; /** * Constructor diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInstance.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInstance.java index b0b837b3b9..fad6490df2 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInstance.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInstance.java @@ -22,9 +22,7 @@ package org.onap.so.bpmn.core.domain; import java.io.Serializable; import java.util.Map; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonRootName; /** * This class is used to store instance data of services aka ServiceDecomposition @@ -46,7 +44,7 @@ public class ServiceInstance extends JsonWrapper implements Serializable { private ModelInfo modelInfo; private String environmentContext; private String workloadContext; - private Map serviceParams; + private transient Map serviceParams; private Customer customer = new Customer(); private String e2eVpnKey; diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java index d3d07f9014..3f10df36ab 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java @@ -323,7 +323,7 @@ public class JsonUtils { logger.debug("getJsonValue(): the raw value is a String Object={}", rawValue); return (String) rawValue; } else { - logger.debug("getJsonValue(): the raw value is NOT a String Object={}", rawValue.toString()); + logger.debug("getJsonValue(): the raw value is NOT a String Object={}", rawValue); return rawValue.toString(); } } @@ -352,7 +352,7 @@ public class JsonUtils { logger.debug("getJsonNodeValue(): the raw value is a String Object={}", rawValue); return (String) rawValue; } else { - logger.debug("getJsonNodeValue(): the raw value is NOT a String Object={}", rawValue.toString()); + logger.debug("getJsonNodeValue(): the raw value is NOT a String Object={}", rawValue); return rawValue.toString(); } } @@ -380,11 +380,10 @@ public class JsonUtils { return 0; } else { if (rawValue instanceof Integer) { - logger.debug("getJsonIntValue(): the raw value is an Integer Object={}", - ((String) rawValue).toString()); + logger.debug("getJsonIntValue(): the raw value is an Integer Object={}", rawValue); return (Integer) rawValue; } else { - logger.debug("getJsonIntValue(): the raw value is NOT an Integer Object={}", rawValue.toString()); + logger.debug("getJsonIntValue(): the raw value is NOT an Integer Object={}", rawValue); return 0; } } @@ -412,8 +411,7 @@ public class JsonUtils { logger.debug("getJsonBooleanValue(): the raw value is a Boolean Object={}", rawValue); return (Boolean) rawValue; } else { - logger.debug("getJsonBooleanValue(): the raw value is NOT an Boolean Object={}", - rawValue.toString()); + logger.debug("getJsonBooleanValue(): the raw value is NOT an Boolean Object={}", rawValue); return false; } } @@ -455,7 +453,7 @@ public class JsonUtils { return null; } else { if (rawValue instanceof JSONArray) { - logger.debug("getJsonParamValue(): keys={} points to JSONArray: {}", keys, rawValue.toString()); + logger.debug("getJsonParamValue(): keys={} points to JSONArray: {}", keys, rawValue); int arrayLen = ((JSONArray) rawValue).length(); if (index < 0 || arrayLen < index + 1) { logger.debug("getJsonParamValue(): index: {} is out of bounds for array size of {}", index, @@ -464,8 +462,7 @@ public class JsonUtils { } int foundCnt = 0; for (int i = 0; i < arrayLen; i++) { - logger.debug("getJsonParamValue(): index: {}, value: {}", i, - ((JSONArray) rawValue).get(i).toString()); + logger.debug("getJsonParamValue(): index: {}, value: {}", i, ((JSONArray) rawValue).get(i)); if (((JSONArray) rawValue).get(i) instanceof JSONObject) { JSONObject jsonObj = (JSONObject) ((JSONArray) rawValue).get(i); String parmValue = jsonObj.get(name).toString(); @@ -482,16 +479,14 @@ public class JsonUtils { continue; } } else { - logger.debug("getJsonParamValue(): the JSONArray element is NOT a JSONObject={}", - rawValue.toString()); + logger.debug("getJsonParamValue(): the JSONArray element is NOT a JSONObject={}", rawValue); return null; } } logger.debug("getJsonParamValue(): content value NOT found for name: {}", name); return null; } else { - logger.debug("getJsonParamValue(): the raw value is NOT a JSONArray Object={}", - rawValue.toString()); + logger.debug("getJsonParamValue(): the raw value is NOT a JSONArray Object={}", rawValue); return null; } } @@ -1057,13 +1052,13 @@ public class JsonUtils { JsonValidator validator = factory.getValidator(); ProcessingReport report = validator.validate(schema, document); - logger.debug("JSON schema validation report: {}", report.toString()); + logger.debug("JSON schema validation report: {}", report); return report.toString(); } catch (IOException e) { - logger.debug("IOException performing JSON schema validation on document: {}", e.toString()); + logger.debug("IOException performing JSON schema validation on document:", e); throw new ValidationException(e.getMessage()); } catch (ProcessingException e) { - logger.debug("ProcessingException performing JSON schema validation on document: {}", e.toString()); + logger.debug("ProcessingException performing JSON schema validation on document:", e); throw new ValidationException(e.getMessage()); } } |