From 0ab9cac55ff9d8b8854bf2bc58c4d17e323353e4 Mon Sep 17 00:00:00 2001 From: Arindam Mondal Date: Tue, 23 Jul 2019 19:12:40 +0900 Subject: Fix null pointer exception +) Fix NPE ++) implement equals instead of == Issue-ID: PORTAL-680 Change-Id: I3a0df60b6171b114afc841b40838f6a4484370ee Signed-off-by: arind.mondal --- .../org/onap/portalapp/portal/controller/RoleManageController.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ecomp-portal-BE-common') diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/RoleManageController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/RoleManageController.java index b50d1cf4..9a525b51 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/RoleManageController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/RoleManageController.java @@ -523,7 +523,7 @@ public class RoleManageController extends EPRestrictedBaseController { EPApp requestedApp = appService.getApp(appId); if (isAuthorizedUser(user, requestedApp)) { fieldsValidation(requestedApp); - if (requestedApp.getCentralAuth()) { + if (requestedApp.getCentralAuth() && roleFunc!=null) { String code = roleFunc.getType() + PIPE + roleFunc.getCode() + PIPE + roleFunc.getAction(); CentralV2RoleFunction domainRoleFunction = externalAccessRolesService.getRoleFunction(code, requestedApp.getUebKey()); @@ -679,7 +679,7 @@ public class RoleManageController extends EPRestrictedBaseController { } @RequestMapping(value = { "/portalApi/centralizedApps" }, method = RequestMethod.GET) - public List getCentralizedAppRoles(HttpServletRequest request, HttpServletResponse response, String userId) throws IOException { + public List getCentralizedAppRoles(HttpServletRequest request, HttpServletResponse response, String userId) { if(userId!=null) { SecureString secureString = new SecureString(userId); @@ -817,7 +817,7 @@ public class RoleManageController extends EPRestrictedBaseController { private boolean isAuthorizedUser(EPUser user, EPApp requestedApp) { if (user != null && (adminRolesService.isAccountAdminOfApplication(user, requestedApp) - || (adminRolesService.isSuperAdmin(user) && requestedApp.getId() == PortalConstants.PORTAL_APP_ID))) + || (adminRolesService.isSuperAdmin(user) && requestedApp.getId().equals(PortalConstants.PORTAL_APP_ID)))) return true; return false; } -- cgit 1.2.3-korg