diff options
author | seshukm <seshu.kumar.m@huawei.com> | 2017-09-27 12:36:45 +0530 |
---|---|---|
committer | seshukm <seshu.kumar.m@huawei.com> | 2017-09-27 12:36:45 +0530 |
commit | 1d1979633d81c74795c9a11b7849af1b6038ba02 (patch) | |
tree | 476e0b3c9b8d44a3ff3f6079396b32a8d7f43e06 /mso-api-handlers/mso-api-handler-infra/src/main/java | |
parent | 35f3dda1f25d7c86d4436f3aa5ce985d76f135d6 (diff) |
Fixed E2EService blocker SONAR
IssueId: SO-118
Change-Id: Ia2e6e0d3bbef4c80721991762876c9ed98043790
Signed-off-by: seshukm <seshu.kumar.m@huawei.com>
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/main/java')
-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) { |