From e77d8b8b29285e6d60b78bd7fad510eb2589464c Mon Sep 17 00:00:00 2001 From: Megala Date: Wed, 5 Oct 2016 11:34:05 +0530 Subject: [PATCH] Adding isEmpty check --- .../mgt/jaxrs/service/impl/UserManagementServiceImpl.java | 8 ++++---- .../impl/admin/UserManagementAdminServiceImpl.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) 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 f6ba34a085..8ec2f898df 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 fbcc38178b..d268eff282 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);