sonar blocker issue fixes 55/10555/4
authorSeshu-Kumar-M <seshu.kumar.m@huawei.com>
Wed, 6 Sep 2017 11:47:14 +0000 (19:47 +0800)
committerSeshu-Kumar-M <seshu.kumar.m@huawei.com>
Thu, 7 Sep 2017 04:47:06 +0000 (10:17 +0530)
Issue ID: SO-98

Change-Id: Ida8eba238c3c0ca867cc40a58d00ddcd74417921
Signed-off-by: Seshu-Kumar-M <seshu.kumar.m@huawei.com>
adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/BpelRestClient.java
adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterAsyncImpl.java
bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNResource.java

index 4218ad8..90d1180 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
@@ -176,7 +176,7 @@ public class BpelRestClient {
                        try {
                                s.add(Integer.parseInt(t));
                        } catch (NumberFormatException x) {
-                               // ignore
+                               LOGGER.debug("Exception while parsing", x);
                        }
                }
                this.retryList = s;
@@ -227,7 +227,7 @@ public class BpelRestClient {
                        try {
                                Thread.sleep(sleepinterval * 1000L);
                        } catch (InterruptedException e) {
-                               // ignore
+                               LOGGER.debug("Exception while Thread sleep", e);
                        }
                }
        }
@@ -240,7 +240,7 @@ public class BpelRestClient {
                LOGGER.debug("Content is: "+toBpelStr);
 
                //Client 4.3+
-               CloseableHttpClient client = HttpClients.createDefault();
+               CloseableHttpClient client = null;
 
                //POST
                HttpPost post = new HttpPost(bpelUrl);
@@ -262,6 +262,7 @@ public class BpelRestClient {
         //Client 4.3+
                //Execute & GetResponse
                try {
+                   client = HttpClients.createDefault();
                        CloseableHttpResponse response = client.execute(post);
                        if (response != null) {
                                lastResponseCode = response.getStatusLine().getStatusCode();
@@ -277,10 +278,12 @@ public class BpelRestClient {
                        lastResponseCode = 900;
                        lastResponse = "";
                } finally {
-                       try {
-                               client.close();
-                       } catch (IOException e) {
-                               // ignore
+                       if(client != null){
+                               try {
+                                       client.close();
+                               } catch (IOException e) {
+                                       LOGGER.debug("Exception while closing client", e);
+                               }
                        }
                }
                LOGGER.debug("Response code from BPEL server: "+lastResponseCode);
index d697182..0878bc5 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
@@ -600,8 +600,9 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
             LOGGER.error (MessageEnum.RA_INIT_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - init notification", e1);
         }
 
-        LOGGER.debug ("Notification Endpoint URL: " + epUrl.toExternalForm ());
-
+        if(null != epUrl) {
+            LOGGER.debug ("Notification Endpoint URL: " + epUrl.toExternalForm ());
+        }
         bp.getRequestContext ().put (BindingProvider.ENDPOINT_ADDRESS_PROPERTY, epUrl.toExternalForm ());
 
         // authentication
index 5ef77ee..1a4c16d 100644 (file)
@@ -82,21 +82,21 @@ public class URNResource extends AbstractCockpitPluginResource{
                                \r
                } catch (Exception e) \r
                {\r
-                       msoLogger.debug("Exception in getUrnDataMap " + e);                     \r
+                       msoLogger.debug("Exception in getUrnDataMap ", e);                      \r
                } finally {\r
                        if(psData != null){\r
                                try {\r
                                        psData.close();\r
                                        conn.close();\r
                                } catch (SQLException e) {\r
-                                       msoLogger.debug("Exception while closing the PreparedStatement: " + e);\r
+                                       msoLogger.debug("Exception while closing the PreparedStatement: ", e);\r
                                }\r
                        }\r
                        if(conn != null){\r
                                try {\r
                                        conn.close();\r
                                } catch (SQLException e) {\r
-                                       msoLogger.debug("Exception while closing the connection: " + e);\r
+                                       msoLogger.debug("Exception while closing the connection: ", e);\r
                                }\r
                        }\r
                }\r
@@ -143,7 +143,7 @@ public class URNResource extends AbstractCockpitPluginResource{
                        \r
                } catch (Exception e) \r
                {\r
-                       msoLogger.debug("Exception in DBConnection " + e);\r
+                       msoLogger.debug("Exception in DBConnection ", e);\r
                }\r
          \r
          return conn;\r
@@ -183,21 +183,21 @@ public class URNResource extends AbstractCockpitPluginResource{
                        \r
                } catch (Exception e) \r
                {\r
-                       msoLogger.debug("Exception in insertNewRow " + e);\r
+                       msoLogger.debug("Exception in insertNewRow ", e);\r
                }finally {\r
                        if(psData != null){\r
                                try {\r
                                        psData.close();\r
                                        conn.close();\r
                                } catch (SQLException e) {\r
-                                       msoLogger.debug("Exception while closing the PreparedStatement: " + e);\r
+                                       msoLogger.debug("Exception while closing the PreparedStatement: ", e);\r
                                }\r
                        }\r
                        if(conn != null){\r
                                try {\r
                                        conn.close();\r
                                } catch (SQLException e) {\r
-                                       msoLogger.debug("Exception while closing the connection: " + e);\r
+                                       msoLogger.debug("Exception while closing the connection: ", e);\r
                                }\r
                        }\r
                }\r
@@ -219,21 +219,21 @@ public class URNResource extends AbstractCockpitPluginResource{
                           \r
                } catch (Exception e) \r
                {\r
-                       msoLogger.debug("Exception in PersistData " + e);\r
+                       msoLogger.debug("Exception in PersistData ", e);\r
                }finally {\r
                        if(psData != null){\r
                                try {\r
                                        psData.close();\r
                                        conn.close();\r
                                } catch (SQLException e) {\r
-                                       msoLogger.debug("Exception while closing the PreparedStatement: " + e);\r
+                                       msoLogger.debug("Exception while closing the PreparedStatement: ", e);\r
                                }\r
                        }\r
                        if(conn != null){\r
                                try {\r
                                        conn.close();\r
                                } catch (SQLException e) {\r
-                                       msoLogger.debug("Exception while closing the connection: " + e);\r
+                                       msoLogger.debug("Exception while closing the connection: ", e);\r
                                }\r
                        }\r
                }\r