From 7b95ccc444c10cc9e36d476602157d004bc3eb52 Mon Sep 17 00:00:00 2001 From: seshukm Date: Wed, 13 Sep 2017 14:50:52 +0530 Subject: bmpn sonar issue fix IssueId: SO-118 Change-Id: Ib7830bb47d41f322a14bc82b7bc99748b547d640 Signed-off-by: seshukm --- .../openecomp/mso/bpmn/core/CamundaDBSetup.java | 10 +++-- .../mso/bpmn/core/HealthCheckHandler.java | 2 + .../mso/bpmn/core/PropertyConfiguration.java | 9 +++-- .../mso/bpmn/core/PropertyConfigurationSetup.java | 33 +++++++++++++++-- .../mso/bpmn/core/domain/JsonWrapper.java | 28 ++++++-------- .../mso/bpmn/core/json/DecomposeJsonUtil.java | 40 ++++++++------------ .../openecomp/mso/bpmn/core/json/JsonUtils.java | 43 +++++++++++----------- .../openecomp/mso/bpmn/core/json/JsonWrapper.java | 28 ++++++-------- 8 files changed, 103 insertions(+), 90 deletions(-) (limited to 'bpmn/MSOCoreBPMN/src/main/java') diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/CamundaDBSetup.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/CamundaDBSetup.java index aba43eb522..74bb59c908 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/CamundaDBSetup.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/CamundaDBSetup.java @@ -5,12 +5,14 @@ import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.SQLException; +import org.openecomp.mso.logger.MsoLogger; + /** * Sets up the unit test (H2) database for Camunda. */ public class CamundaDBSetup { private static boolean isDBConfigured = false; - + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); public static synchronized void configure() throws SQLException { if (isDBConfigured) { return; @@ -66,13 +68,13 @@ public class CamundaDBSetup { isDBConfigured = true; } catch (SQLException e) { System.out.println("CamundaDBSetup caught " + e.getClass().getSimpleName()); - e.printStackTrace(); + LOGGER.debug("SQLException :",e); } finally { if (stmt != null) { try { stmt.close(); } catch (Exception e) { - // Ignore + LOGGER.debug("Exception :",e); } } @@ -80,7 +82,7 @@ public class CamundaDBSetup { try { connection.close(); } catch (Exception e) { - // Ignore + LOGGER.debug("Exception :",e); } } } diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/HealthCheckHandler.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/HealthCheckHandler.java index eb1cd51efb..55f6221dfb 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/HealthCheckHandler.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/HealthCheckHandler.java @@ -3,6 +3,7 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -200,6 +201,7 @@ public class HealthCheckHandler { UUID uuid = UUID.fromString(id); return uuid.toString().equalsIgnoreCase(id); } catch (IllegalArgumentException iae) { + msoLogger.debug("IllegalArgumentException :",iae); return false; } } diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfiguration.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfiguration.java index 9d3af1c3be..70f67a5a77 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfiguration.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfiguration.java @@ -3,6 +3,7 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -167,7 +168,7 @@ public class PropertyConfiguration { fileWatcherThread.join(waitInSeconds * 1000); } catch (InterruptedException e) { LOGGER.debug("FileWatcherThread " + System.identityHashCode(fileWatcherThread) - + " shutdown did not occur within " + waitInSeconds + " seconds"); + + " shutdown did not occur within " + waitInSeconds + " seconds",e); } LOGGER.debug("Finished shutting down FileWatcherThread " + System.identityHashCode(fileWatcherThread)); @@ -257,7 +258,7 @@ public class PropertyConfiguration { reader.close(); LOGGER.debug("Closed " + fileName); } catch (Exception e) { - // Ignore + LOGGER.debug("Exception :",e); } } } @@ -351,12 +352,14 @@ public class PropertyConfiguration { } } } catch (InterruptedException e) { + LOGGER.debug("InterruptedException :",e); break; } catch (ClosedWatchServiceException e) { LOGGER.info( MessageEnum.BPMN_GENERAL_INFO, "BPMN", "FileWatcherThread shut down because the watch service was closed"); + LOGGER.debug("ClosedWatchServiceException :",e); break; } catch (Exception e) { LOGGER.error( @@ -379,7 +382,7 @@ public class PropertyConfiguration { watchService.close(); } catch (IOException e) { LOGGER.debug("FileWatcherThread caught " + e.getClass().getSimpleName() - + " while closing the watch service"); + + " while closing the watch service",e); } LOGGER.info(MessageEnum.BPMN_GENERAL_INFO, "BPMN", diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfigurationSetup.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfigurationSetup.java index f58efe79c8..ce171b56e4 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfigurationSetup.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfigurationSetup.java @@ -1,3 +1,24 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package org.openecomp.mso.bpmn.core; import java.io.FileOutputStream; @@ -11,6 +32,8 @@ import java.util.HashMap; import java.util.Map; import java.util.Properties; +import org.openecomp.mso.logger.MsoLogger; + import org.openecomp.mso.bpmn.core.PropertyConfiguration; /** @@ -22,6 +45,8 @@ public class PropertyConfigurationSetup { private static Path bpmnPropertiesPath = null; private static Path bpmnUrnPropertiesPath = null; private static boolean modifiedConfiguration = false; + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); /** * Ensures that the the PropertyConfiguration is initialized and that the @@ -232,7 +257,7 @@ public class PropertyConfigurationSetup { try { fileReader.close(); } catch (IOException e) { - // Ignore + LOGGER.debug("Exception :",e); } } @@ -240,7 +265,7 @@ public class PropertyConfigurationSetup { try { outputStream.close(); } catch (IOException e) { - // Ignore + LOGGER.debug("Exception :",e); } } } @@ -279,7 +304,7 @@ public class PropertyConfigurationSetup { try { fileReader.close(); } catch (IOException e) { - // Ignore + LOGGER.debug("Exception :",e); } } @@ -287,7 +312,7 @@ public class PropertyConfigurationSetup { try { outputStream.close(); } catch (IOException e) { - // Ignore + LOGGER.debug("Exception :",e); } } } diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/JsonWrapper.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/JsonWrapper.java index 10e52d1b0d..dc87304795 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/JsonWrapper.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/JsonWrapper.java @@ -16,7 +16,7 @@ import com.fasterxml.jackson.databind.ObjectWriter; import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.databind.annotation.JsonSerialize; - +import org.openecomp.mso.logger.MsoLogger; //import org.codehaus.jackson.map.SerializationConfig.Feature; @@ -29,6 +29,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize; @JsonInclude(Include.NON_NULL) public abstract class JsonWrapper implements Serializable { + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); @JsonInclude(Include.NON_NULL) public String toJsonString(){ @@ -54,7 +55,7 @@ public abstract class JsonWrapper implements Serializable { // } } catch (Exception e){ - e.printStackTrace(); + LOGGER.debug("Exception :",e); } return jsonString; } @@ -72,17 +73,13 @@ public abstract class JsonWrapper implements Serializable { try { json = new JSONObject(mapper.writeValueAsString(this)); } catch (JsonGenerationException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + LOGGER.debug("Exception :",e); } catch (JsonMappingException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + LOGGER.debug("Exception :",e); } catch (JSONException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + LOGGER.debug("Exception :",e); } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + LOGGER.debug("Exception :",e); } return json; } @@ -95,14 +92,11 @@ public abstract class JsonWrapper implements Serializable { try { jsonString = mapper.writeValueAsString(list); } catch (JsonGenerationException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + LOGGER.debug("Exception :",e); } catch (JsonMappingException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + LOGGER.debug("Exception :",e); } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + LOGGER.debug("Exception :",e); } return jsonString; } @@ -120,7 +114,7 @@ public abstract class JsonWrapper implements Serializable { jsonString = ow.writeValueAsString(this); } catch (Exception e){ - e.printStackTrace(); + LOGGER.debug("Exception :",e); } return jsonString; } diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/DecomposeJsonUtil.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/DecomposeJsonUtil.java index 32c4776daf..738ec49590 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/DecomposeJsonUtil.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/DecomposeJsonUtil.java @@ -14,8 +14,10 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; +import org.openecomp.mso.logger.MsoLogger; + public class DecomposeJsonUtil implements Serializable { - + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); /** * */ @@ -40,14 +42,11 @@ public class DecomposeJsonUtil implements Serializable { try { serviceDecomposition = om.readValue(jsonString, ServiceDecomposition.class); } catch (JsonParseException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + LOGGER.debug("JsonParseException :",e); } catch (JsonMappingException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + LOGGER.debug("JsonMappingException :",e); } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + LOGGER.debug("IOException :",e); } return serviceDecomposition; @@ -72,14 +71,11 @@ public class DecomposeJsonUtil implements Serializable { try { vnfResource = om.readValue(jsonString, VnfResource.class); } catch (JsonParseException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + LOGGER.debug("JsonParseException :",e); } catch (JsonMappingException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + LOGGER.debug("JsonMappingException :",e); } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + LOGGER.debug("IOException :",e); } return vnfResource; } @@ -103,14 +99,11 @@ public class DecomposeJsonUtil implements Serializable { try { networkResource = om.readValue(jsonString, NetworkResource.class); } catch (JsonParseException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + LOGGER.debug("Exception :",e); } catch (JsonMappingException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + LOGGER.debug("Exception :",e); } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + LOGGER.debug("Exception :",e); } return networkResource; } @@ -134,14 +127,11 @@ public class DecomposeJsonUtil implements Serializable { try { allottedResource = om.readValue(jsonString, AllottedResource.class); } catch (JsonParseException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + LOGGER.debug("Exception :",e); } catch (JsonMappingException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + LOGGER.debug("Exception :",e); } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + LOGGER.debug("Exception :",e); } return allottedResource; } diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java index f7f6264de0..54a5732e1c 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java @@ -3,6 +3,7 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -67,7 +68,7 @@ public class JsonUtils { return jsonObj.toString(MSOJsonIndentFactor); } } catch (Exception e){ - msoLogger.debug("xml2json(): unable to parse xml and convert to json. Exception was: " + e.toString()); + msoLogger.debug("xml2json(): unable to parse xml and convert to json. Exception was: " + e.toString(), e); return null; } } @@ -106,7 +107,7 @@ public class JsonUtils { return toXMLString(jsonObj, null); } } catch (Exception e){ - msoLogger.debug("json2xml(): unable to parse json and convert to xml. Exception was: " + e.toString()); + msoLogger.debug("json2xml(): unable to parse json and convert to xml. Exception was: " + e.toString(), e); return null; } } @@ -264,7 +265,7 @@ public class JsonUtils { JSONObject jsonObj = new JSONObject(jsonStr); return jsonObj.toString(MSOJsonIndentFactor); } catch (Exception e){ - msoLogger.debug("prettyJson(): unable to parse/format json input. Exception was: " + e.toString()); + msoLogger.debug("prettyJson(): unable to parse/format json input. Exception was: " + e.toString(), e); return null; } } @@ -334,7 +335,7 @@ public class JsonUtils { } } } catch (Exception e) { - msoLogger.debug("getJsonValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString()); + msoLogger.debug("getJsonValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString(),e); } return null; } @@ -363,7 +364,7 @@ public class JsonUtils { } } } catch (Exception e) { - msoLogger.debug("getJsonNodeValue(): unable to parse json to retrieve node for field=" + keys + ". Exception was: " + e.toString()); + msoLogger.debug("getJsonNodeValue(): unable to parse json to retrieve node for field=" + keys + ". Exception was: " + e.toString(), e); } return null; } @@ -395,7 +396,7 @@ public class JsonUtils { } } } catch (Exception e) { - msoLogger.debug("getJsonValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString()); + msoLogger.debug("getJsonValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString(), e); } return 0; } @@ -424,7 +425,7 @@ public class JsonUtils { } } } catch (Exception e) { - msoLogger.debug("getJsonValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString()); + msoLogger.debug("getJsonValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString(),e); } return false; } @@ -500,9 +501,9 @@ public class JsonUtils { } } catch (JSONException je) { // JSONObject::get() throws this exception if one of the specified keys is not found - msoLogger.debug("getJsonParamValue(): caught JSONException attempting to retrieve param value for keys:" + keys + ", name=" + name); + msoLogger.debug("getJsonParamValue(): caught JSONException attempting to retrieve param value for keys:" + keys + ", name=" + name, je); } catch (Exception e) { - msoLogger.debug("getJsonParamValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString()); + msoLogger.debug("getJsonParamValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString(), e); } return null; } @@ -523,7 +524,7 @@ public class JsonUtils { return getJsonValueForKey(jsonObj, key); } } catch (Exception e) { - msoLogger.debug("getJsonValueForKey(): unable to parse json to retrieve value for field=" + key + ". Exception was: " + e.toString()); + msoLogger.debug("getJsonValueForKey(): unable to parse json to retrieve value for field=" + key + ". Exception was: " + e.toString(), e); } return null; } @@ -567,10 +568,10 @@ public class JsonUtils { } } catch (JSONException je) { // JSONObject::get() throws this exception if one of the specified keys is not found - msoLogger.debug("getJsonValueForKey(): caught JSONException attempting to retrieve value for key=" + key); + msoLogger.debug("getJsonValueForKey(): caught JSONException attempting to retrieve value for key=" + key, je); keyValue = null; } catch (Exception e) { - msoLogger.debug("getJsonValueForKey(): unable to parse json to retrieve value for field=" + key + ". Exception was: " + e.toString()); + msoLogger.debug("getJsonValueForKey(): unable to parse json to retrieve value for field=" + key + ". Exception was: " + e.toString(), e); } return keyValue; } @@ -610,10 +611,10 @@ public class JsonUtils { } } catch (JSONException je) { // JSONObject::get() throws this exception if one of the specified keys is not found - msoLogger.debug("getJsonValueForKey(): caught JSONException attempting to retrieve value for key=" + key); + msoLogger.debug("getJsonValueForKey(): caught JSONException attempting to retrieve value for key=" + key, je); keyValue = null; } catch (Exception e) { - msoLogger.debug("getJsonValueForKey(): unable to parse json to retrieve value for field=" + key + ". Exception was: " + e.toString()); + msoLogger.debug("getJsonValueForKey(): unable to parse json to retrieve value for field=" + key + ". Exception was: " + e.toString(),e); } return keyValue; } @@ -653,10 +654,10 @@ public class JsonUtils { } } catch (JSONException je) { // JSONObject::get() throws this exception if one of the specified keys is not found - msoLogger.debug("getJsonBooleanValueForKey(): caught JSONException attempting to retrieve value for key=" + key); + msoLogger.debug("getJsonBooleanValueForKey(): caught JSONException attempting to retrieve value for key=" + key,je); keyValue = null; } catch (Exception e) { - msoLogger.debug("getJsonBooleanValueForKey(): unable to parse json to retrieve value for field=" + key + ". Exception was: " + e.toString()); + msoLogger.debug("getJsonBooleanValueForKey(): unable to parse json to retrieve value for field=" + key + ". Exception was: " + e.toString(),e); } return keyValue; } @@ -800,9 +801,9 @@ public class JsonUtils { } catch (JSONException je) { // JSONObject::get() throws this exception if one of the specified keys is not found - msoLogger.debug("getJsonRawValue(): caught JSONException attempting to retrieve raw value for key=" + keyStr); + msoLogger.debug("getJsonRawValue(): caught JSONException attempting to retrieve raw value for key=" + keyStr,je); } catch (Exception e) { - msoLogger.debug("getJsonRawValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString()); + msoLogger.debug("getJsonRawValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString(),e); } return null; } @@ -842,10 +843,10 @@ public class JsonUtils { } catch (JSONException je) { // JSONObject::get() throws this exception if one of the specified keys is not found - msoLogger.debug("putJsonValue(): caught JSONException attempting to retrieve value for key=" + keyStr); + msoLogger.debug("putJsonValue(): caught JSONException attempting to retrieve value for key=" + keyStr,je); return null; } catch (Exception e) { - msoLogger.debug("putJsonValue(): unable to parse json to put value for key=" + keys + ". Exception was: " + e.toString()); + msoLogger.debug("putJsonValue(): unable to parse json to put value for key=" + keys + ". Exception was: " + e.toString(),e); } return null; } @@ -961,7 +962,7 @@ public class JsonUtils { return true; } } catch (Exception e) { - msoLogger.debug("jsonElementExist(): unable to determine if json element exist. Exception is: " + e.toString()); + msoLogger.debug("jsonElementExist(): unable to determine if json element exist. Exception is: " + e.toString(),e); } return true; } diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonWrapper.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonWrapper.java index 8898f27b23..ac514b967f 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonWrapper.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonWrapper.java @@ -15,12 +15,15 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectWriter; import com.fasterxml.jackson.databind.SerializationFeature; +import org.openecomp.mso.logger.MsoLogger; + @JsonInclude(Include.NON_NULL) public abstract class JsonWrapper implements Serializable { private static final long serialVersionUID = 8633550139273639875L; + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); @JsonInclude(Include.NON_NULL) public String toJsonString(){ @@ -45,7 +48,7 @@ public abstract class JsonWrapper implements Serializable { // } } catch (Exception e){ - e.printStackTrace(); + LOGGER.debug("Exception :",e); } return jsonString; } @@ -63,17 +66,13 @@ public abstract class JsonWrapper implements Serializable { try { json = new JSONObject(mapper.writeValueAsString(this)); } catch (JsonGenerationException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + LOGGER.debug("Exception :",e); } catch (JsonMappingException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + LOGGER.debug("Exception :",e); } catch (JSONException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + LOGGER.debug("Exception :",e); } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + LOGGER.debug("Exception :",e); } return json; } @@ -86,14 +85,11 @@ public abstract class JsonWrapper implements Serializable { try { jsonString = mapper.writeValueAsString(list); } catch (JsonGenerationException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + LOGGER.debug("Exception :",e); } catch (JsonMappingException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + LOGGER.debug("Exception :",e); } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + LOGGER.debug("Exception :",e); } return jsonString; } @@ -111,7 +107,7 @@ public abstract class JsonWrapper implements Serializable { jsonString = ow.writeValueAsString(this); } catch (Exception e){ - e.printStackTrace(); + LOGGER.debug("Exception :",e); } return jsonString; } -- cgit 1.2.3-korg