diff options
author | Seshu Kumar M <seshu.kumar.m@huawei.com> | 2019-04-27 06:37:45 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-04-27 06:37:45 +0000 |
commit | 834a36f0dea88e68eb8305d07f191ea6d51a1cd5 (patch) | |
tree | 24932af04ec7ec957b2dc5203543bb9f67ea8d4b /bpmn/MSOCoreBPMN | |
parent | 0bb58cfbe91dd7b77178f775df16d873131eb1ef (diff) | |
parent | 941712fe497afb6dda9291784743e36aadb22b95 (diff) |
Merge "Removed imports and defined a constant. Removed imports and defined constant and combined exception in single catch block. Issue-ID: SO-1490"
Diffstat (limited to 'bpmn/MSOCoreBPMN')
-rw-r--r-- | bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java | 1 | ||||
-rw-r--r-- | bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/JsonWrapper.java | 23 |
2 files changed, 9 insertions, 15 deletions
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java index 897cbe3573..309b053589 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java @@ -21,7 +21,6 @@ package org.onap.so.bpmn.core.domain; import java.io.Serializable; -import java.util.List; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonRootName; diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/JsonWrapper.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/JsonWrapper.java index 602172f8a4..bf53c880e9 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/JsonWrapper.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/JsonWrapper.java @@ -45,6 +45,7 @@ import org.slf4j.LoggerFactory; */ @JsonInclude(Include.NON_NULL) public abstract class JsonWrapper implements Serializable { + private static final String EXCEPTION = "Exception :"; private static final Logger logger = LoggerFactory.getLogger(JsonWrapper.class); @@ -63,7 +64,7 @@ public abstract class JsonWrapper implements Serializable { jsonString = ow.writeValueAsString(this); } catch (Exception e) { - logger.debug("Exception :", e); + logger.debug(EXCEPTION, e); } return jsonString; } @@ -76,14 +77,10 @@ public abstract class JsonWrapper implements Serializable { JSONObject json = new JSONObject(); try { json = new JSONObject(mapper.writeValueAsString(this)); - } catch (JsonGenerationException e) { - logger.debug("Exception :", e); - } catch (JsonMappingException e) { - logger.debug("Exception :", e); - } catch (JSONException e) { - logger.debug("Exception :", e); + } catch (JsonGenerationException | JsonMappingException | JSONException e) { + logger.debug(EXCEPTION, e); } catch (IOException e) { - logger.debug("Exception :", e); + logger.debug(EXCEPTION, e); } return json; } @@ -95,12 +92,10 @@ public abstract class JsonWrapper implements Serializable { String jsonString = ""; try { jsonString = mapper.writeValueAsString(list); - } catch (JsonGenerationException e) { - logger.debug("Exception :", e); - } catch (JsonMappingException e) { - logger.debug("Exception :", e); + } catch (JsonGenerationException | JsonMappingException e) { + logger.debug(EXCEPTION, e); } catch (IOException e) { - logger.debug("Exception :", e); + logger.debug(EXCEPTION, e); } return jsonString; } @@ -118,7 +113,7 @@ public abstract class JsonWrapper implements Serializable { jsonString = ow.writeValueAsString(this); } catch (Exception e) { - logger.debug("Exception :", e); + logger.debug(EXCEPTION, e); } return jsonString; } |