diff --git a/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/impl/SCIMRoleManagerV2.java b/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/impl/SCIMRoleManagerV2.java index e4bc1119d..90c0cbe88 100644 --- a/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/impl/SCIMRoleManagerV2.java +++ b/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/impl/SCIMRoleManagerV2.java @@ -942,9 +942,8 @@ private void doUpdatePermissions(String roleId, Set addedPermissions, Se } catch (IdentityRoleManagementException e) { if (RoleConstants.Error.INVALID_REQUEST.getCode().equals(e.getErrorCode())) { throw new BadRequestException(e.getMessage()); - } else if (RoleConstants.Error.INVALID_PERMISSION.getCode() - .equals(ROLE_MANAGEMENT_ERROR_CODE_PREFIX + e.getErrorCode())) { - throw new BadRequestException(e.getMessage()); + } else if (RoleConstants.Error.INVALID_PERMISSION.getCode().equals(e.getErrorCode())) { + throw new BadRequestException(e.getMessage(), ResponseCodeConstants.INVALID_VALUE); } throw new CharonException( String.format("Error occurred while updating permissions of the role with ID: %s", roleId), e);