aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNITIN KAWA <nitin.kawa@huawei.com>2019-04-26 06:07:05 +0000
committerNITIN KAWA <nitin.kawa@huawei.com>2019-04-26 06:07:05 +0000
commit941712fe497afb6dda9291784743e36aadb22b95 (patch)
treefb187bce748196fb7a620e86a0f12cfed04c644e
parent9a1a01dd07e5a64422bca75fa22ea36daa1d88d1 (diff)
Removed imports and defined a constant.
Removed imports and defined constant and combined exception in single catch block. Issue-ID: SO-1490 Change-Id: Iefeb59de5b5e32b06908e62ba24a1bc00892ce1d Signed-off-by: NITIN KAWA <nitin.kawa@huawei.com>
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java1
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/JsonWrapper.java23
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;
}