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>
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 + "'.");