diff options
author | Havaldar Girish <hg0071052@techmahindra.com> | 2018-02-08 09:19:10 +0530 |
---|---|---|
committer | Havaldar Girish <hg0071052@techmahindra.com> | 2018-02-08 09:24:49 +0530 |
commit | ed404fea2eae15505b42a15e35f762be3dfc74d9 (patch) | |
tree | 2fb1282423d9c351b004264a645fb538bc4d9e7e | |
parent | 21a8761f684745bb300e075c7e98ad897ace9eed (diff) |
check if localsession object null before closing
Before closing the session check if the localsession is not null
Sonar Link:
https://sonar.onap.org/component_issues/index?id=org.onap.portal%3Aonap-portal-parent#resolved=false|severities=BLOCKER
Location:
/src/main/java/org/openecomp/portalapp/portal/service/UserRolesCommonServiceImpl.java
Line No-382
Change-Id: Id44800c1ab0ee03dd4920c756fb85b342dc1dd2a
Issue-ID: PORTAL-154
Signed-off-by: Havaldar Girish <hg0071052@techmahindra.com>
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/UserRolesCommonServiceImpl.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/UserRolesCommonServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/UserRolesCommonServiceImpl.java index 3535f753..c65b4af9 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/UserRolesCommonServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/UserRolesCommonServiceImpl.java @@ -371,7 +371,9 @@ public class UserRolesCommonServiceImpl { throw new Exception(e.getMessage()); } } finally { - localSession.close(); + if (localSession != null) { + localSession.close(); + } if (!result && !"DELETE".equals(reqType)) { throw new Exception( "Exception occurred in syncUserRoles while closing database session for app: '" + appId + "'."); |