Fixed E2EService blocker SONAR 19/15819/1
authorseshukm <seshu.kumar.m@huawei.com>
Wed, 27 Sep 2017 07:06:45 +0000 (12:36 +0530)
committerseshukm <seshu.kumar.m@huawei.com>
Wed, 27 Sep 2017 07:06:45 +0000 (12:36 +0530)
IssueId: SO-118

Change-Id: Ia2e6e0d3bbef4c80721991762876c9ed98043790
Signed-off-by: seshukm <seshu.kumar.m@huawei.com>
mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java

index 0c0c3cb..927cec6 100644 (file)
@@ -189,8 +189,10 @@ public class E2EServiceInstances {
                }
 
                CatalogDatabase db = null;
+               RecipeLookupResult recipeLookupResult = null;
                try {
                        db = CatalogDatabase.getInstance();
+                       recipeLookupResult = getServiceInstanceOrchestrationURI(db, sir, action);
                } catch (Exception e) {
                        msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Catalog DB", e);
                        msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
@@ -206,36 +208,10 @@ public class E2EServiceInstances {
                        msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while communciate with DB");
                        msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
                        return response;
-               }
-
-
-               RecipeLookupResult recipeLookupResult = null;
-
-               try {
-                       recipeLookupResult = getServiceInstanceOrchestrationURI(db, sir, action);
-               } catch (Exception e) {
-                       msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "Exception while querying Catalog DB", e);
-                       msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
-                       Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND,
-                                       MsoException.ServiceException,
-                                       "Recipe could not be retrieved from catalog DB " + e.getMessage (),
-                                       ErrorNumbers.SVC_GENERAL_SERVICE_ERROR,
-                                       null);
-                       alarmLogger.sendAlarm ("MsoDatabaseAccessError",
-                                       MsoAlarmLogger.CRITICAL,
-                                       Messages.errors.get (ErrorNumbers.ERROR_FROM_CATALOG_DB));
-                       msoRequest.createRequestRecord (Status.FAILED,action);
-                       msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while querying Catalog DB");
-                       msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
-                       db.close();
-                       return response;
-               }
-               finally{
-                       if(null != db)
-                       {
-                               db.close();
+               } finally {
+                       if(db != null) {
+                           db.close();
                        }
-
                }
 
                if (recipeLookupResult == null) {