diff --git a/services/src/main/java/org/keycloak/services/resources/admin/UserResource.java b/services/src/main/java/org/keycloak/services/resources/admin/UserResource.java index 4d367fdf74..b12b196345 100755 --- a/services/src/main/java/org/keycloak/services/resources/admin/UserResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/UserResource.java @@ -686,9 +686,15 @@ public class UserResource { } ClientModel client = realm.getClientByClientId(clientId); - if (client == null || !client.isEnabled()) { + if (client == null) { + logger.debugf("Client %s doesn't exist", clientId); throw new WebApplicationException( - ErrorResponse.error(clientId + " not enabled", Status.BAD_REQUEST)); + ErrorResponse.error("Client doesn't exist", Status.BAD_REQUEST)); + } + if (!client.isEnabled()) { + logger.debugf("Client %s is not enabled", clientId); + throw new WebApplicationException( + ErrorResponse.error("Client is not enabled", Status.BAD_REQUEST)); } String redirect; diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/UserTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/UserTest.java index 08aad3bb65..16ee6c4004 100755 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/UserTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/UserTest.java @@ -709,7 +709,7 @@ public class UserTest extends AbstractAdminTest { assertEquals(400, e.getResponse().getStatus()); ErrorRepresentation error = e.getResponse().readEntity(ErrorRepresentation.class); - Assert.assertEquals("invalidClientId not enabled", error.getErrorMessage()); + Assert.assertEquals("Client doesn't exist", error.getErrorMessage()); } } @@ -1108,7 +1108,7 @@ public class UserTest extends AbstractAdminTest { assertEquals(400, e.getResponse().getStatus()); ErrorRepresentation error = e.getResponse().readEntity(ErrorRepresentation.class); - Assert.assertEquals("invalidClientId not enabled", error.getErrorMessage()); + Assert.assertEquals("Client doesn't exist", error.getErrorMessage()); } user.sendVerifyEmail();