From 3fa63b90661cea6d0563038f9f31f17a58a6f3c8 Mon Sep 17 00:00:00 2001 From: seshukm Date: Mon, 11 Sep 2017 14:29:25 +0530 Subject: Fix for SONAR critical issues Issue Id : SO-117 Change-Id: I7774a2d35f46398c3c3d6a9b4da97a0a52ef941e Signed-off-by: seshukm --- .../org/openecomp/mso/requestsdb/RequestsDatabase.java | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'mso-api-handlers/mso-requests-db/src') diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java index b950c1b5c8..8db4548bad 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java @@ -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. @@ -519,9 +520,7 @@ public class RequestsDatabase { } session.getTransaction ().commit (); } finally { - if (session != null && session.isOpen ()) { - session.close (); - } + session.close (); msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "updateSiteStatus", null); } } @@ -588,9 +587,7 @@ public class RequestsDatabase { } session.getTransaction().commit(); } finally { - if(session != null && session.isOpen()) { - session.close(); - } + session.close(); msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "updateOperationStatus", null); } @@ -663,9 +660,7 @@ public class RequestsDatabase { } session.getTransaction().commit(); } finally { - if(session != null && session.isOpen()) { - session.close(); - } + session.close(); msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "updateResOperStatus", null); } @@ -720,9 +715,7 @@ public class RequestsDatabase { } updateOperationStatus(serviceOperStatus); } finally { - if(session != null && session.isOpen()) { - session.close(); - } + session.close(); msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "updateResOperStatus", null); } -- cgit 1.2.3-korg