Removed imports and defined a constant. 55/86355/1
authorNITIN KAWA <nitin.kawa@huawei.com>
Fri, 26 Apr 2019 06:07:05 +0000 (06:07 +0000)
committerNITIN KAWA <nitin.kawa@huawei.com>
Fri, 26 Apr 2019 06:07:05 +0000 (06:07 +0000)
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>
bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java
bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/JsonWrapper.java

index 897cbe3..309b053 100644 (file)
@@ -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;
 
index 602172f..bf53c88 100644 (file)
@@ -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;
     }