diff options
author | Rob Daugherty <rd472p@att.com> | 2017-09-27 15:53:22 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2017-09-27 15:53:22 +0000 |
commit | df40d93895c8cc9ec4ad6e35452817713c104824 (patch) | |
tree | eb213d1b70fe50daaebb420a7ed6222a32328bb5 /mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp | |
parent | 0b6072bf483e14e47ffc039cdbf79ae90d5cec0e (diff) | |
parent | 1d1979633d81c74795c9a11b7849af1b6038ba02 (diff) |
Merge "Fixed E2EService blocker SONAR IssueId: SO-118"
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp')
-rw-r--r-- | mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java | 34 |
1 files changed, 5 insertions, 29 deletions
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) { |