bmpn sonar issue fix 37/12137/1
authorseshukm <seshu.kumar.m@huawei.com>
Wed, 13 Sep 2017 09:18:07 +0000 (14:48 +0530)
committerseshukm <seshu.kumar.m@huawei.com>
Wed, 13 Sep 2017 09:20:02 +0000 (14:50 +0530)
IssueId: SO-118

Change-Id: I7fe10c7c8266105edbe0f67c434ec389cbe5fe02
Signed-off-by: seshukm <seshu.kumar.m@huawei.com>
common/src/main/java/org/openecomp/mso/logger/MsoLogger.java
common/src/main/java/org/openecomp/mso/utils/UUIDChecker.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ManualTasks.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/TasksHandler.java
mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java

index d41f241..19115ce 100644 (file)
@@ -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.
index 1252333..b715717 100644 (file)
@@ -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.
@@ -28,6 +29,8 @@ import java.util.UUID;
 /**
  */
 public class UUIDChecker {
+       
+       private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL);
 
     private UUIDChecker() {
 
@@ -41,6 +44,7 @@ public class UUIDChecker {
             UUID uuid = UUID.fromString(id);
             return uuid.toString().equalsIgnoreCase(id);
         } catch (IllegalArgumentException iae) {
+               LOGGER.debug("IllegalArgumentException", iae);
             return false;
         }
     }
index acdae29..f3273cf 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP - SO\r
  * ================================================================================\r
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.\r
  * ================================================================================\r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -190,7 +191,7 @@ public class ManualTasks {
                                completeResp = mapper.writeValueAsString(trr);\r
                        }\r
                        catch (Exception e) {\r
-                               msoLogger.debug("Unable to format response");\r
+                               msoLogger.debug("Unable to format response",e);\r
                                Response resp = msoRequest.buildServiceErrorResponse(bpelStatus,\r
                                                MsoException.ServiceException,\r
                                                "Request Failed due to bad response format" ,\r
index e7a2334..eab232d 100644 (file)
@@ -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.
@@ -215,7 +216,7 @@ public class MsoRequest {
                requestJSON = mapper.writeValueAsString(sir.getRequestDetails());
 
         } catch(Exception e){
-               throw new ValidationException ("Parse ServiceInstanceRequest to JSON string");
+               throw new ValidationException ("Parse ServiceInstanceRequest to JSON string",e);
         }
 
         if(instanceIdMap != null){
index a176f69..26fdba4 100644 (file)
@@ -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.
@@ -343,7 +344,7 @@ public class OrchestrationRequests {
                requestDetails = mapper.readValue(requestBody, RequestDetails.class);
 
        }catch(Exception e){
-               msoLogger.debug("Exception caught mapping requestBody to RequestDetails");
+               msoLogger.debug("Exception caught mapping requestBody to RequestDetails",e);
        }
 
        request.setRequestDetails(requestDetails);
index a196cc0..e32f153 100644 (file)
@@ -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.
@@ -649,7 +650,7 @@ public class ServiceInstances {
                        msoRequest.updateFinalStatus (Status.FAILED);
                        msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine");
                        msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine");
-                       msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
+                       msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity (),e);
                        return resp;
                }
 
index b191a3d..1e8bea0 100644 (file)
@@ -164,7 +164,7 @@ public class TasksHandler {
                        msoRequest.updateFinalStatus (Status.FAILED);
                        msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine");
                        msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine");
-                       msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
+                       msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity (),e);
                        return resp;
                }
                TasksGetResponse trr = new TasksGetResponse();
@@ -206,7 +206,7 @@ public class TasksHandler {
                                                
                                                msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine");
                                                msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine");
-                                               msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ());
+                                               msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity (),e);
                                                return resp;
                                        }
                                        taskList.add(taskListEntry);                            
@@ -235,7 +235,7 @@ public class TasksHandler {
                        jsonResponse = mapper.writeValueAsString(trr);
                }
                catch (Exception e) {
-                       msoLogger.debug("Unable to format response");
+                       msoLogger.debug("Unable to format response",e);
                        Response resp = msoRequest.buildServiceErrorResponse(500,
                                        MsoException.ServiceException,
                                        "Request Failed due to bad response format" ,
index de46fd9..20450ca 100644 (file)
@@ -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.
@@ -329,7 +330,7 @@ public class CatalogDatabase implements Closeable {
         try {
                environment = (HeatEnvironment) query.uniqueResult ();
         } catch (org.hibernate.NonUniqueResultException nure) {
-               LOGGER.debug("Non Unique Result Exception - the Catalog Database does not match a unique row for Envt - data integrity error: artifactUuid='" + artifactUuid +"'");
+               LOGGER.debug("Non Unique Result Exception - the Catalog Database does not match a unique row for Envt - data integrity error: artifactUuid='" + artifactUuid +"'", nure);
                LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for heatEnvironment artifactUuid=" + artifactUuid, "", "", MsoLogger.ErrorCode.DataError, "Non unique result for artifactUuid==" + artifactUuid);
                environment = null;
         } catch (org.hibernate.HibernateException he) {
@@ -554,7 +555,7 @@ public class CatalogDatabase implements Closeable {
         try {
             result = (Service) query.uniqueResult();
         } catch (org.hibernate.NonUniqueResultException nure) {
-            LOGGER.debug("Non Unique Result Exception - the Catalog Database does not match a unique row - data integrity error: modelInvariantId='" + modelInvariantId + "', modelVersion='" + modelVersion + "'");
+            LOGGER.debug("Non Unique Result Exception - the Catalog Database does not match a unique row - data integrity error: modelInvariantId='" + modelInvariantId + "', modelVersion='" + modelVersion + "'", nure);
             LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for modelInvariantId=" + modelInvariantId + " and modelVersion=" + modelVersion, "", "", MsoLogger.ErrorCode.DataError, "Non unique result for modelInvariantId=" + modelInvariantId);
             throw new Exception("Non Unique Result Exception - the Catalog Database does not match a unique row - data integrity error: modelInvariantId='" + modelInvariantId + "', modelVersion='" + modelVersion + "'");
         }
@@ -3537,8 +3538,7 @@ public class CatalogDatabase implements Closeable {
                        //session.merge(heat);
                        session.save(heat);
                     } catch (HibernateException he1) {
-                       LOGGER.debug("Hibernate Exception encountered on first attempt at save(heat) - try again..." + he1.getMessage());
-                       LOGGER.debug(he1.getStackTrace().toString());
+                       LOGGER.debug("Hibernate Exception encountered on first attempt at save(heat) - try again..." + he1.getMessage(), he1);
                        try {
                                Session session = this.getSession();
                                //session.merge(heat);
@@ -3548,24 +3548,24 @@ public class CatalogDatabase implements Closeable {
                                LOGGER.debug(he2.getStackTrace().toString());
                                throw he2;
                        } catch (Exception e2) {
-                               LOGGER.debug("General Exception encountered on second attempt at save(heat)..." + e2.getMessage());
+                               LOGGER.debug("General Exception encountered on second attempt at save(heat)..." + e2.getMessage(),e2);
                                LOGGER.debug(e2.getStackTrace().toString());
                                throw e2;
                        }
                        
                     } catch (Exception e1) {
-                       LOGGER.debug("General Exception encountered on first attempt at save(heat) - try again..." + e1.getMessage());
+                       LOGGER.debug("General Exception encountered on first attempt at save(heat) - try again..." + e1.getMessage(), e1);
                        LOGGER.debug(e1.getStackTrace().toString());
                        try {
                                Session session = this.getSession();
                                //session.merge(heat);
                                session.save(heat);
                        } catch (HibernateException he2) {
-                               LOGGER.debug("General Exception encountered on second attempt at save(heat)" + he2.getMessage());
+                               LOGGER.debug("General Exception encountered on second attempt at save(heat)" + he2.getMessage(), he2);
                                LOGGER.debug(he2.getStackTrace().toString());
                                throw he2;
                        } catch (Exception e2) {
-                               LOGGER.debug("General Exception encountered on second attempt at save(heat)..." + e2.getMessage());
+                               LOGGER.debug("General Exception encountered on second attempt at save(heat)..." + e2.getMessage(), e2);
                                LOGGER.debug(e2.getStackTrace().toString());
                                throw e2;
                        }
@@ -3607,15 +3607,15 @@ public class CatalogDatabase implements Closeable {
         try {
                env = (HeatEnvironment) query.uniqueResult ();
         } catch (org.hibernate.NonUniqueResultException nure) {
-               LOGGER.debug("Non Unique Result Exception - the Catalog Database does not match a unique row - data integrity error: envName='" + name + "', version='" + version + "' and asdcResourceName=" + asdcResourceName);
+               LOGGER.debug("Non Unique Result Exception - the Catalog Database does not match a unique row - data integrity error: envName='" + name + "', version='" + version + "' and asdcResourceName=" + asdcResourceName, nure);
                LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for envName=" + name + " and version=" + version + " and asdcResourceName=" + asdcResourceName, "", "", MsoLogger.ErrorCode.DataError, "non unique result for envName=" + name);
                env = null;
         } catch (org.hibernate.HibernateException he) {
-               LOGGER.debug("Hibernate Exception - while searching for: envName='" + name + "', asdc_service_model_version='" + version + "' and asdcResourceName=" + asdcResourceName);
+               LOGGER.debug("Hibernate Exception - while searching for: envName='" + name + "', asdc_service_model_version='" + version + "' and asdcResourceName=" + asdcResourceName, he);
                LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Hibernate exception searching for envName=" + name + " and version=" + version + " and asdcResourceName=" + asdcResourceName, "", "", MsoLogger.ErrorCode.DataError, "Hibernate exception searching for envName=" + name);
                env = null;
         } catch (Exception e) {
-               LOGGER.debug("Generic Exception - while searching for: envName='" + name + "', asdc_service_model_version='" + version + "' and asdcResourceName=" + asdcResourceName);
+               LOGGER.debug("Generic Exception - while searching for: envName='" + name + "', asdc_service_model_version='" + version + "' and asdcResourceName=" + asdcResourceName, e);
                LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Generic exception searching for envName=" + name + " and version=" + version + " and asdcResourceName=" + asdcResourceName, "", "", MsoLogger.ErrorCode.DataError, "Generic exception searching for envName=" + name);
                env = null;
         }
@@ -3767,7 +3767,7 @@ public class CatalogDatabase implements Closeable {
         try {
                LOGGER.debug(vnfResourceCustomization.toString());
         } catch (Exception e) {
-               LOGGER.debug("Unable to print VRC " + e.getMessage());
+               LOGGER.debug("Unable to print VRC " + e.getMessage(), e);
         }
         try {
                         // Check if NetworkResourceCustomzation record already exists.  If so, skip saving it.
@@ -3789,7 +3789,7 @@ public class CatalogDatabase implements Closeable {
                        try {
                                LOGGER.debug("Existing VRC entry found\n" + existing.toString());
                        } catch (Exception e) {
-                               LOGGER.debug("Unable to print VRC2 " + e.getMessage());
+                               LOGGER.debug("Unable to print VRC2 " + e.getMessage(), e);
                        }
                        return false;
                }
@@ -4074,7 +4074,7 @@ public class CatalogDatabase implements Closeable {
                LOGGER.debug("heat template id = " + vfModule.getHeatTemplateArtifactUUId() + ", vol template id = "+ vfModule.getVolHeatTemplateArtifactUUId());
                LOGGER.debug(vfModule.toString());
         } catch (Exception e) {
-               LOGGER.debug("unable to print vfmodule " + e.getMessage());
+               LOGGER.debug("unable to print vfmodule " + e.getMessage(), e);
         }
         try {
                VfModule existing = this.getVfModuleByModelUUID(vfModule.getModelUUID());
@@ -4087,7 +4087,7 @@ public class CatalogDatabase implements Closeable {
                        try {
                                LOGGER.debug("Found an existing vf module!\n" + existing.toString());
                        } catch (Exception e) {
-                               LOGGER.debug("unable to print vfmodule2 " + e.getMessage());
+                               LOGGER.debug("unable to print vfmodule2 " + e.getMessage(), e);
             }
                }
                
@@ -4137,7 +4137,7 @@ public class CatalogDatabase implements Closeable {
                LOGGER.debug("env id = " + vfModuleCustomization.getHeatEnvironmentArtifactUuid() + ", vol Env=" + vfModuleCustomization.getVolEnvironmentArtifactUuid());
                LOGGER.debug(vfModuleCustomization.toString());
         } catch (Exception e) {
-               LOGGER.debug("unable to print vfmodulecust " + e.getMessage());
+               LOGGER.debug("unable to print vfmodulecust " + e.getMessage(), e);
         }
         try {
                VfModuleCustomization existing = this.getVfModuleCustomizationByModelCustomizationId(vfModuleCustomization.getModelCustomizationUuid());
@@ -4148,7 +4148,7 @@ public class CatalogDatabase implements Closeable {
                        try {
                                LOGGER.debug("Found an existing vf module customization entry\n" + existing.toString());
                        } catch (Exception e) {
-                               LOGGER.debug("unable to print vfmodulecust2 " + e.getMessage());
+                               LOGGER.debug("unable to print vfmodulecust2 " + e.getMessage(), e);
                }
                }
       
@@ -4420,7 +4420,7 @@ public class CatalogDatabase implements Closeable {
             
             return resultList.get (0);
         } catch (Exception e) {
-               LOGGER.debug("Error trying to find Network Resource with " + modelUUID +", " + e.getMessage());
+               LOGGER.debug("Error trying to find Network Resource with " + modelUUID +", " + e.getMessage(),e);
         } finally {
             LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getNetworkResourceByModelUuid", null);
         }
@@ -4544,7 +4544,7 @@ public class CatalogDatabase implements Closeable {
 
             return resultList.get (0);
         } catch (Exception e) {
-               LOGGER.debug("Error trying to find Network Resource with " + modelCustomizationUuid +", " + e.getMessage());
+               LOGGER.debug("Error trying to find Network Resource with " + modelCustomizationUuid +", " + e.getMessage(),e);
         } finally {
             LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getNetworkResourceByModelCustUuid", null);
         }
@@ -5062,7 +5062,7 @@ public class CatalogDatabase implements Closeable {
                try {
                        LOGGER.debug("Returning theObjects:" + theObjects.size());
                } catch (Exception e) {
-                       LOGGER.debug("Returning theObjects");
+                       LOGGER.debug("Returning theObjects",e);
                }
                LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "executeQuerySingleRow", null);
         }