<div dir="ltr">Not sure why this is turning into a lengthy discussion, but null in the representation has a meaning. If you look at how it&#39;s implemented the lack of a value (it&#39;s set to null) results in setting the default value only if creating a new entity. If updating an existing entity a null value is simply ignored. If you initialize these in the representation you will end up overriding existing values. The idea is that someone can update a single value without having to include all existing values.</div><div class="gmail_extra"><br><div class="gmail_quote">On 12 November 2015 at 14:45, Stan Silvert <span dir="ltr">&lt;<a href="mailto:ssilvert@redhat.com" target="_blank">ssilvert@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF"><span class="">
    <div>On 11/12/2015 8:41 AM, Stian Thorgersen
      wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">The bug is simply caused by not checking for null</div>
    </blockquote></span>
    Seriously?  So every time you call a getter on a Representation you
    have to check for null?<br>
    <br>
    If a Boolean should not be null then initialize it properly or use
    boolean.<div><div class="h5"><br>
    <blockquote type="cite">
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On 12 November 2015 at 14:40, Stan
          Silvert <span dir="ltr">&lt;<a href="mailto:ssilvert@redhat.com" target="_blank">ssilvert@redhat.com</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div text="#000000" bgcolor="#FFFFFF">
              <div>On 11/12/2015 8:33 AM, Stian Thorgersen wrote:<br>
              </div>
              <blockquote type="cite">
                <div dir="ltr">RepresentationToModel</div>
              </blockquote>
              The bug happened before RepresentationToModel could be
              called.  That&#39;s why we need to initialize variables
              properly.
              <div>
                <div><br>
                  <blockquote type="cite">
                    <div class="gmail_extra"><br>
                      <div class="gmail_quote">On 12 November 2015 at
                        14:20, Stan Silvert <span dir="ltr">&lt;<a href="mailto:ssilvert@redhat.com" target="_blank">ssilvert@redhat.com</a>&gt;</span>
                        wrote:<br>
                        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                          <div text="#000000" bgcolor="#FFFFFF"><span>
                              <div>On 11/12/2015 7:39 AM, Stian
                                Thorgersen wrote:<br>
                              </div>
                              <blockquote type="cite">
                                <div dir="ltr"><br>
                                  <div class="gmail_extra"><br>
                                    <div class="gmail_quote">On 12
                                      November 2015 at 13:12, Stan
                                      Silvert <span dir="ltr">&lt;<a href="mailto:ssilvert@redhat.com" target="_blank">ssilvert@redhat.com</a>&gt;</span>
                                      wrote:<br>
                                      <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                                        <div text="#000000" bgcolor="#FFFFFF">
                                          <div>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&#39;m not ready to
                                            merge that yet.<br>
                                            <br>
                                            We really need to go through
                                            all the representations and
                                            set defaults for all
                                            instance variables of type
                                            Boolean.  It&#39;s probably rare
                                            that we would want that
                                            default to be null.  Even if
                                            it should be null we should
                                            say so explicitly.</div>
                                        </div>
                                      </blockquote>
                                      <div><br>
                                      </div>
                                      <div>-1 We want them to be null.
                                        We set defaults elsewhere</div>
                                    </div>
                                  </div>
                                </div>
                              </blockquote>
                            </span> Where?
                            <div>
                              <div><br>
                                <blockquote type="cite">
                                  <div dir="ltr">
                                    <div class="gmail_extra">
                                      <div class="gmail_quote">
                                        <div> </div>
                                        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                                          <div text="#000000" bgcolor="#FFFFFF">
                                            <div><span><font color="#888888"><br>
                                                  <br>
                                                  Stan</font></span>
                                              <div>
                                                <div><br>
                                                  <br>
                                                  On 11/12/2015 5:42 AM,
                                                  Stian Thorgersen
                                                  wrote:<br>
                                                </div>
                                              </div>
                                            </div>
                                            <div>
                                              <div>
                                                <blockquote type="cite">
                                                  <div dir="ltr">That&#39;s
                                                    a bug. It&#39;s failing
                                                    on &quot;if
                                                    (rep.isServiceAccountsEnabled()
                                                    ..)&quot;,
                                                    but serviceAccountsEnabled
                                                    in the
                                                    representation can
                                                    be null, which would
                                                    result in this NPE.
                                                    <div><br>
                                                    </div>
                                                    <div>Can you create
                                                      a JIRA please? If
                                                      you did a PR as
                                                      well that&#39;d be
                                                      even better :)</div>
                                                  </div>
                                                  <div class="gmail_extra"><br>
                                                    <div class="gmail_quote">On
                                                      12 November 2015
                                                      at 10:58, Juraj
                                                      Janosik <span dir="ltr">&lt;<a href="mailto:juraj.janosik77@gmail.com" target="_blank">juraj.janosik77@gmail.com</a>&gt;</span>
                                                      wrote:<br>
                                                      <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                                                        <div dir="ltr">
                                                          <div>
                                                          <div>
                                                          <div>
                                                          <div>
                                                          <div>
                                                          <div>
                                                          <div>Hi,<br>
                                                          <br>
                                                          </div>
                                                          I want to
                                                          announce an
                                                          issue with &quot;<a href="http://keycloak.github.io/docs/rest-api/index.html#_update_the_client" target="_blank">Update the client</a>&quot; via Admin REST API.<br>
                                                          </div>
                                                          <div><br>
                                                          <u>Description:</u>
                                                          I want to
                                                          change the
                                                          description
                                                          for existing
                                                          client #3.<br>
                                                          <br>
                                                          <u>Note:</u>
                                                          From the
                                                          documentation
                                                          (&quot;<a href="http://keycloak.github.io/docs/rest-api/index.html#_update_the_client" target="_blank">Update the client</a>&quot;), body parameter attributes <br>
                                                          are required
                                                          in schema
                                                          &quot;ClientRepresentation&quot;.<br>
                                                          </div>
                                                          <div>Description

                                                          of schema
                                                          &quot;ClientRepresentation&quot;
                                                          notes for any
                                                          mandatory
                                                          attribute.<br>
                                                          <br>
                                                          Are some
                                                          parameters
                                                          mandatory for
                                                          successfuly
                                                          running of
                                                          this scenario
                                                          ?<br>
                                                          <br>
                                                          </div>
                                                          <u>Tested
                                                          scenario:</u><br>
                                                          <u>Tested
                                                          data:</u><br>
                                                          &quot;Update
                                                          Client&quot;:<br>
&quot;method&quot;:&quot;PUT&quot;,&quot;url&quot;:&quot;&lt;URL&gt;:&lt;PORT&gt;/auth/admin/realms/&lt;REALM&gt;/clients/3&quot;<br>
                                                          <div>&quot;headers&quot;:<br>
[[&quot;Content-Type&quot;,&quot;application/json&quot;],<br>
                                                          <div>[&quot;Authorization&quot;,&quot;Bearer
&lt;ACCESS_TOKEN&gt;]]</div>
                                                          </div>
                                                          <div>&quot;body&quot;:<br>
                                                          &quot;{<br>
                                                          &quot;id&quot;:&quot;3&quot;,<br>
&quot;clientId&quot;:&quot;testclient-3&quot;,<br>
                                                          &quot;name&quot;:
                                                          &quot;testclient-3&quot;,<br>
                                                          &quot;description&quot;:
                                                          &quot;TESTCLIENT-3
                                                          v.2&quot;<br>
                                                          }&quot;<br>
                                                          </div>
                                                          <br>
                                                          </div>
                                                          <u>Test
                                                          Result:</u>
                                                          Status Code:
                                                          500 Internal
                                                          Server Error<br>
                                                          <br>
                                                          </div>
                                                          <u>Some parts
                                                          from console
                                                          logs:</u><br>
                                                          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<br>
                                                          ...<br>
                                                              at
org.keycloak.services.filters.KeycloakSessionServletFilter.doFilter(KeycloakSessionServletFilter.java:61)<br>
                                                              ... 29
                                                          more<br>
                                                          <b>Caused by:
java.lang.NullPointerException</b><br>
                                                              at
org.keycloak.services.resources.admin.ClientResource.update(ClientResource.java:106)<br>
                                                          <br>
                                                          <br>
                                                          </div>
                                                          Thanks a lot.<br>
                                                          <br>
                                                          </div>
                                                          Best Regards,<br>
                                                          </div>
                                                          Juraj<br>
                                                          <div>
                                                          <div>
                                                          <div>
                                                          <div>
                                                          <div>
                                                          <div><br>
                                                          <br>
                                                          </div>
                                                          </div>
                                                          </div>
                                                          </div>
                                                          </div>
                                                          </div>
                                                        </div>
                                                        <br>
_______________________________________________<br>
                                                        keycloak-user
                                                        mailing list<br>
                                                        <a href="mailto:keycloak-user@lists.jboss.org" target="_blank">keycloak-user@lists.jboss.org</a><br>
                                                        <a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-user</a><br>
                                                      </blockquote>
                                                    </div>
                                                    <br>
                                                  </div>
                                                  <br>
                                                  <fieldset></fieldset>
                                                  <br>
                                                  <pre>_______________________________________________
keycloak-user mailing list
<a href="mailto:keycloak-user@lists.jboss.org" target="_blank">keycloak-user@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-user</a></pre>
                                                </blockquote>
                                                <br>
                                              </div>
                                            </div>
                                          </div>
                                          <br>
_______________________________________________<br>
                                          keycloak-user mailing list<br>
                                          <a href="mailto:keycloak-user@lists.jboss.org" target="_blank">keycloak-user@lists.jboss.org</a><br>
                                          <a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-user</a><br>
                                        </blockquote>
                                      </div>
                                      <br>
                                    </div>
                                  </div>
                                </blockquote>
                                <br>
                              </div>
                            </div>
                          </div>
                        </blockquote>
                      </div>
                      <br>
                    </div>
                  </blockquote>
                  <br>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </div></div></div>

</blockquote></div><br></div>