Fix critical sonar issues 81/13481/1
authorGaurav Agrawal <gaurav.agrawal@huawei.com>
Tue, 19 Sep 2017 13:36:33 +0000 (19:06 +0530)
committerGaurav Agrawal <gaurav.agrawal@huawei.com>
Tue, 19 Sep 2017 13:41:22 +0000 (19:11 +0530)
Fix critical sonar issues in CCSDK SLI Northbound by either logging or
rethrowing the exception
https://sonar.onap.org/component_issues/index?id=org.onap.ccsdk.sli.northbound%3Accsdk-sli-northbound#resolved=false|severities=CRITICAL

Change-Id: I718f13b5801ea9d69b5c36f75b5387a0ae59cc6a
Issue-Id: CCSDK-67
Signed-off-by: Gaurav Agrawal <gaurav.agrawal@huawei.com>
asdcApi/provider/src/main/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiProvider.java
dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/DmaapListener.java
dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncFlatJsonDmaapConsumer.java
ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncArtifactMap.java
ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebConfiguration.java

index b9c897e..cebcb99 100644 (file)
@@ -157,8 +157,7 @@ public class AsdcApiProvider implements AutoCloseable, ASDCAPIService {
             LOG.info("Create Containers succeeded!: ");
 
         } catch (InterruptedException | ExecutionException e) {
-            LOG.error("Create Containers Failed: " + e);
-            e.printStackTrace();
+            LOG.error("Create Containers Failed: ", e);
         }
         } else {
             LOG.warn("createContainers : cannot find dataBroker to create containers");
index 91afe1d..ec34fe4 100644 (file)
@@ -106,7 +106,7 @@ public class DmaapListener {
                                try {
                                        consumerClass = Class.forName(consumerClassName);
                                } catch (Exception e) {
-                                       LOG.error("Could not find DMaap consumer class " + consumerClassName);
+                                       LOG.error("Could not find DMaap consumer class {}", consumerClassName, e);
                                }
 
                                if (consumerClass != null) {
index 1754957..7196c90 100644 (file)
@@ -135,7 +135,7 @@ public class SdncFlatJsonDmaapConsumer extends SdncDmaapConsumer {
                                LOG.info("POST message body would be:\n"+rpcMsgbody);
                        }
                } catch (Exception e) {
-
+                       LOG.error("Unable to process message", e);
                }
 
        }
index dd9437c..9b36cb6 100644 (file)
@@ -66,7 +66,7 @@ public class SdncArtifactMap {
                        try {
                                this.pass = Integer.parseInt(pass);
                        } catch (Exception e) {
-                               LOG.error("Invalid pass value for artifact map entry ("+tag+","+rpc+","+pass+")");
+                               LOG.error("Invalid pass value for artifact map entry ({} {} {})", tag, rpc, pass, e);
                        }
                }
        }
index 3c56111..3ea092d 100644 (file)
@@ -132,7 +132,7 @@ public class SdncUebConfiguration implements IConfiguration{
                        try {
                                pollingInterval = Integer.parseInt(curval);
                        } catch (Exception e) {
-                               LOG.warn("Illegal value for org.onap.ccsdk.sli.northbound.uebclient.polling-interval ("+curval+")");
+                               LOG.warn("Illegal value for org.onap.ccsdk.sli.northbound.uebclient.polling-interval ({}) ", curval, e);
                        }
                }
 
@@ -141,7 +141,7 @@ public class SdncUebConfiguration implements IConfiguration{
                        try {
                                pollingTimeout = Integer.parseInt(curval);
                        } catch (Exception e) {
-                               LOG.warn("Illegal value for org.onap.ccsdk.sli.northbound.uebclient.polling-timeout ("+curval+")");
+                               LOG.warn("Illegal value for org.onap.ccsdk.sli.northbound.uebclient.polling-timeout ({}) ", curval, e);
                        }
                }