summaryrefslogtreecommitdiffstats
path: root/adapters
diff options
context:
space:
mode:
authorWitold Ficio Kopel <w.kopel@samsung.com>2019-03-26 09:17:02 +0100
committerWitold Ficio Kopel <w.kopel@samsung.com>2019-03-26 13:12:09 +0100
commit59700d14ff998413dada0cb2e0864e643edbb77e (patch)
treed066adaedc28efce511d5fc66750f34e91eedb22 /adapters
parentaf46c0d4b30ecb5c8f36992e74adb86d7d5bbe06 (diff)
Eliminated printStackTrace() calls
Eliminated calls to printStackTrace() on Throwable as they go to stdout and are not handled by logger. Occurences has been replaced by calls to logger or modifications to nearby logger calls (Throwable passed as last parameter). Occurences in unit test classes left without modification. Change-Id: I6a771d60a3ea69ceecc29bb21358e565aa5ce101 Issue-ID: LOG-631 Signed-off-by: Witold Ficio Kopel <w.kopel@samsung.com>
Diffstat (limited to 'adapters')
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java2
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java13
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java6
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java18
5 files changed, 20 insertions, 21 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
index 50bcb8e54a..bee2d09711 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
@@ -545,7 +545,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{
}
catch (Exception e) {
// Catch-all. Log the message and throw the original exception
- logger.debug("Cancel workflow {} failed for deployment : {} {}", workflowId, deploymentId, e);
+ logger.debug("Cancel workflow {} failed for deployment {} :", workflowId, deploymentId, e);
MsoCloudifyException exception = new MsoCloudifyException (-1, "", "", savedException);
exception.setPendingWorkflow(true);
throw exception;
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
index e8ef86a3b4..054234015f 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
@@ -1295,7 +1295,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
Set<HeatTemplateParam> paramSet = template.getParameters();
logger.debug("paramSet has {} entries", paramSet.size());
} catch (Exception e) {
- logger.debug("Exception occurred in convertInputMap:" + e.getMessage(), e);
+ logger.debug("Exception occurred in convertInputMap {} :", e.getMessage(), e);
}
for (HeatTemplateParam htp : template.getParameters()) {
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
index 949027f7c1..77e1449079 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
@@ -221,7 +221,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
}
} catch (Exception e) {
// might be ok - both are just blank
- logger.debug("ERROR trying to parse the volumeGroupHeatStackId " + volumeGroupHeatStackId,e);
+ logger.debug("ERROR trying to parse the volumeGroupHeatStackId {}", volumeGroupHeatStackId,e);
}
this.createVfModule(cloudSiteId,
cloudOwner,
@@ -586,9 +586,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
final Object obj = JSON_MAPPER.treeToValue(node, Object.class);
return JSON_MAPPER.writeValueAsString(obj);
} catch (JsonParseException jpe) {
- logger.debug("Error converting json to string " + jpe.getMessage(),jpe);
+ logger.debug("Error converting json to string: {}", jpe.getMessage(),jpe);
} catch (Exception e) {
- logger.debug("Error converting json to string " + e.getMessage(),e);
+ logger.debug("Error converting json to string: {}", e.getMessage(),e);
}
return "[Error converting json to string]";
}
@@ -1904,14 +1904,13 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
jsonNode = JSON_MAPPER.readTree(jsonString);
} catch (JsonParseException jpe) {
//TODO - what to do here?
- //for now - send the error to debug, but just leave it as a String
- String errorMessage = jpe.getMessage();
- logger.debug("Json Error Converting " + parm.getParamName() + " - " + errorMessage,jpe);
+ //for now - send the error to debug
+ logger.debug("Json Error Converting {} - {}", parm.getParamName(), jpe.getMessage(), jpe);
hasJson = false;
jsonNode = null;
} catch (Exception e) {
// or here?
- logger.debug("Json Error Converting " + parm.getParamName() + " " + e.getMessage(), e);
+ logger.debug("Json Error Converting {} {}", parm.getParamName(), e.getMessage(), e);
hasJson = false;
jsonNode = null;
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
index 2b49290727..62c373bea8 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
@@ -415,21 +415,21 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
String str = "" + stackOutputs.get(key);
stringOutputs.put(key, str);
} catch (Exception e) {
- logger.debug("Unable to add " + key + " to outputs", e);
+ logger.debug("Unable to add {} to outputs", key, e);
}
} else if (stackOutputs.get(key) instanceof JsonNode) {
try {
String str = this.convertNode((JsonNode) stackOutputs.get(key));
stringOutputs.put(key, str);
} catch (Exception e) {
- logger.debug("Unable to add " + key + " to outputs - exception converting JsonNode", e);
+ logger.debug("Unable to add {} to outputs - exception converting JsonNode", key, e);
}
} else if (stackOutputs.get(key) instanceof java.util.LinkedHashMap) {
try {
String str = JSON_MAPPER.writeValueAsString(stackOutputs.get(key));
stringOutputs.put(key, str);
} catch (Exception e) {
- logger.debug("Unable to add " + key + " to outputs - exception converting LinkedHashMap", e);
+ logger.debug("Unable to add {} to outputs - exception converting LinkedHashMap", key, e);
}
} else {
try {
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java
index bea4c1bb3b..80f111b570 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java
@@ -85,7 +85,7 @@ public class SDNCRestClient{
@Async
public void executeRequest(SDNCAdapterRequest bpelRequest)
{
-
+
logger.debug("BPEL Request:" + bpelRequest.toString());
// Added delay to allow completion of create request to SDNC
@@ -93,7 +93,9 @@ public class SDNCRestClient{
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
- e.printStackTrace();
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "SDNC",
+ ErrorCode.UnknownError.getValue(), "Exception processing request to SDNC", e);
+
Thread.currentThread().interrupt();
}
@@ -104,12 +106,10 @@ public class SDNCRestClient{
String sdncReqBody = null;
-
-
RequestTunables rt = new RequestTunables(bpelReqId,
bpelRequest.getRequestHeader().getMsoAction(),
bpelRequest.getRequestHeader().getSvcOperation(),
- bpelRequest.getRequestHeader().getSvcAction());
+ bpelRequest.getRequestHeader().getSvcAction());
rt = tunablesMapper.setTunables(rt);
rt.setSdncaNotificationUrl(env.getProperty(Constants.MY_URL_PROP));
@@ -176,8 +176,8 @@ public class SDNCRestClient{
sdncResp.setRespCode(con.getResponseCode());
sdncResp.setRespMsg(con.getResponseMessage());
- if (con.getResponseCode()>= 200 && con.getResponseCode()<=299) {
- in = new BufferedReader(new InputStreamReader(con.getInputStream()));
+ if (con.getResponseCode()>= 200 && con.getResponseCode()<=299) {
+ in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
//Not parsing the response -it contains a responseHdr section and data section
while ((inputLine = in.readLine()) != null) {
@@ -185,7 +185,7 @@ public class SDNCRestClient{
}
in.close();
}
-
+
sdncResp.setSdncRespXml(response.toString());
logger.info("{} :\n {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.name(), sdncResp.toString(), "SDNC");
return(sdncResp);
@@ -314,7 +314,7 @@ public class SDNCRestClient{
SDNCCallbackAdapterPortType cbPort = cbSvc.getSDNCCallbackAdapterSoapHttpPort();
BindingProvider bp = (BindingProvider)cbPort;
-
+
if(null != wsdlUrl) {
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, wsdlUrl.toExternalForm());
}