diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/UserManagementServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/UserManagementServiceImpl.java index f6ba34a085a..8ec2f898dfe 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/UserManagementServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/UserManagementServiceImpl.java @@ -107,7 +107,7 @@ public class UserManagementServiceImpl implements UserManagementService { @Override public Response getUser(@PathParam("username") String username, @QueryParam("domain") String domain, @HeaderParam("If-Modified-Since") String ifModifiedSince) { - if (domain != null) { + if (domain != null && !domain.isEmpty()) { username = domain + '/' + username; } try { @@ -135,7 +135,7 @@ public class UserManagementServiceImpl implements UserManagementService { @Path("/{username}") @Override public Response updateUser(@PathParam("username") String username, @QueryParam("domain") String domain, UserInfo userInfo) { - if (domain != null) { + if (domain != null && !domain.isEmpty()) { username = domain + '/' + username; } try { @@ -212,7 +212,7 @@ public class UserManagementServiceImpl implements UserManagementService { @Path("/{username}") @Override public Response removeUser(@PathParam("username") String username, @QueryParam("domain") String domain) { - if (domain != null) { + if (domain != null && !domain.isEmpty()) { username = domain + '/' + username; } try { @@ -243,7 +243,7 @@ public class UserManagementServiceImpl implements UserManagementService { @Path("/{username}/roles") @Override public Response getRolesOfUser(@PathParam("username") String username, @QueryParam("domain") String domain) { - if (domain != null) { + if (domain != null && !domain.isEmpty()) { username = domain + '/' + username; } try { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/admin/UserManagementAdminServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/admin/UserManagementAdminServiceImpl.java index fbcc38178b7..d268eff2826 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/admin/UserManagementAdminServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/admin/UserManagementAdminServiceImpl.java @@ -38,7 +38,7 @@ public class UserManagementAdminServiceImpl implements UserManagementAdminServic public Response resetUserPassword(@PathParam("username") @Size(max = 45) String user, @QueryParam("domain") String domain, PasswordResetWrapper credentials) { - if (domain != null) { + if (domain != null && !domain.isEmpty()) { user = domain + '/' + user; } return CredentialManagementResponseBuilder.buildResetPasswordResponse(user, credentials);