From 1d1979633d81c74795c9a11b7849af1b6038ba02 Mon Sep 17 00:00:00 2001 From: seshukm Date: Wed, 27 Sep 2017 12:36:45 +0530 Subject: Fixed E2EService blocker SONAR IssueId: SO-118 Change-Id: Ia2e6e0d3bbef4c80721991762876c9ed98043790 Signed-off-by: seshukm --- .../mso/apihandlerinfra/E2EServiceInstances.java | 34 ++++------------------ 1 file changed, 5 insertions(+), 29 deletions(-) (limited to 'mso-api-handlers/mso-api-handler-infra/src') diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java index 0c0c3cb339..927cec66f1 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java @@ -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) { -- cgit 1.2.3-korg