[keycloak-user] Issue (500 Internal Server Error) with "Update the client" via Admin REST API

Stian Thorgersen sthorger at redhat.com
Thu Nov 12 08:41:12 EST 2015


The bug is simply caused by not checking for null

On 12 November 2015 at 14:40, Stan Silvert <ssilvert at redhat.com> wrote:

> On 11/12/2015 8:33 AM, Stian Thorgersen wrote:
>
> RepresentationToModel
>
> The bug happened before RepresentationToModel could be called.  That's why
> we need to initialize variables properly.
>
>
> On 12 November 2015 at 14:20, Stan Silvert <ssilvert at redhat.com> wrote:
>
>> On 11/12/2015 7:39 AM, Stian Thorgersen wrote:
>>
>>
>>
>> On 12 November 2015 at 13:12, Stan Silvert <ssilvert at redhat.com> wrote:
>>
>>> Funny.  I just ran into that exact NPE yesterday but I thought it was a
>>> state that was caused by my new code.  So I only fixed it in that one
>>> representation class.  But I'm not ready to merge that yet.
>>>
>>> We really need to go through all the representations and set defaults
>>> for all instance variables of type Boolean.  It's probably rare that we
>>> would want that default to be null.  Even if it should be null we should
>>> say so explicitly.
>>>
>>
>> -1 We want them to be null. We set defaults elsewhere
>>
>> Where?
>>
>>
>>
>>>
>>>
>>> Stan
>>>
>>>
>>> On 11/12/2015 5:42 AM, Stian Thorgersen wrote:
>>>
>>> That's a bug. It's failing on "if (rep.isServiceAccountsEnabled() ..)",
>>> but serviceAccountsEnabled in the representation can be null, which would
>>> result in this NPE.
>>>
>>> Can you create a JIRA please? If you did a PR as well that'd be even
>>> better :)
>>>
>>> On 12 November 2015 at 10:58, Juraj Janosik <juraj.janosik77 at gmail.com>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> I want to announce an issue with "Update the client
>>>> <http://keycloak.github.io/docs/rest-api/index.html#_update_the_client>"
>>>> via Admin REST API.
>>>>
>>>> *Description:* I want to change the description for existing client #3.
>>>>
>>>> *Note:* From the documentation ("Update the client
>>>> <http://keycloak.github.io/docs/rest-api/index.html#_update_the_client>"),
>>>> body parameter attributes
>>>> are required in schema "ClientRepresentation".
>>>> Description of schema "ClientRepresentation" notes for any mandatory
>>>> attribute.
>>>>
>>>> Are some parameters mandatory for successfuly running of this scenario ?
>>>>
>>>> *Tested scenario:*
>>>> *Tested data:*
>>>> "Update Client":
>>>> "method":"PUT","url":"<URL>:<PORT>/auth/admin/realms/<REALM>/clients/3"
>>>> "headers":
>>>> [["Content-Type","application/json"],
>>>> ["Authorization","Bearer <ACCESS_TOKEN>]]
>>>> "body":
>>>> "{
>>>> "id":"3",
>>>> "clientId":"testclient-3",
>>>> "name": "testclient-3",
>>>> "description": "TESTCLIENT-3 v.2"
>>>> }"
>>>>
>>>> *Test Result:* Status Code: 500 Internal Server Error
>>>>
>>>> *Some parts from console logs:*
>>>> 10:35:31,591 ERROR [io.undertow.request] (default task-18) UT005023:
>>>> Exception handling request to /auth/admin/realms/universities/clients/3:
>>>> java.lang.RuntimeException: request path:
>>>> /auth/admin/realms/universities/clients/3
>>>> ...
>>>>     at
>>>> org.keycloak.services.filters.KeycloakSessionServletFilter.doFilter(KeycloakSessionServletFilter.java:61)
>>>>     ... 29 more
>>>> *Caused by: java.lang.NullPointerException*
>>>>     at
>>>> org.keycloak.services.resources.admin.ClientResource.update(ClientResource.java:106)
>>>>
>>>>
>>>> Thanks a lot.
>>>>
>>>> Best Regards,
>>>> Juraj
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> keycloak-user mailing list
>>>> keycloak-user at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/keycloak-user
>>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> keycloak-user mailing listkeycloak-user at lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/keycloak-user
>>>
>>>
>>>
>>> _______________________________________________
>>> keycloak-user mailing list
>>> keycloak-user at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/keycloak-user
>>>
>>
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20151112/b15e9757/attachment.html 


More information about the keycloak-user mailing list