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 2d3a04aa2..fea1f231d 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 @@ -714,7 +714,7 @@ private void doUpdateRoleName(RoleV2 oldRole, RoleV2 newRole) } } - private String getCurrentRoleName(String roleId, String tenantDomain) throws CharonException, BadRequestException { + private String getCurrentRoleName(String roleId, String tenantDomain) throws CharonException, NotFoundException { String currentRoleName; try { @@ -724,7 +724,7 @@ private String getCurrentRoleName(String roleId, String tenantDomain) throws Cha } } catch (IdentityRoleManagementException e) { if ((ROLE_NOT_FOUND.getCode()).equals(e.getErrorCode())) { - throw new BadRequestException(e.getMessage()); + throw new NotFoundException(e.getMessage()); } throw new CharonException(String.format("Error occurred while getting the role name by " + "the role id: %s", roleId), e);