check if localsession object null before closing
[portal.git] / ecomp-portal-BE-common / src / main / java / org / onap / portalapp / portal / service / UserRolesCommonServiceImpl.java
index 3535f75..c65b4af 100644 (file)
@@ -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 + "'.");