<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div>Hello,</div><div><br data-mce-bogus="1"></div><div>I tried the code snipped and actually it's a bug in the MidPoint Client I was able to reproduce. I have created a Jira issue under <a href="https://jira.evolveum.com/browse/MID-7686">https://jira.evolveum.com/browse/MID-7686</a> and also already pushed a fix. You should find it on the current master branch of the MidPoint Client project. </div><div> <!--StartFragment--><div data-marker="__SIG_POST__" style="color: #000000; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-mce-style="color: #000000; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">--<br></div><div style="color: #000000; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-mce-style="color: #000000; font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">Best Regards,<br><br>Matus Macik | Developer and Identity Management Engineer<br>matus.macik@evolveum.com | www.evolveum.com<br>Evolveum</div><!--EndFragment--> </div><hr id="zwchr" data-marker="__DIVIDER__"><div data-marker="__HEADERS__"><b>From: </b>"midPoint General Discussion" <midpoint@lists.evolveum.com><br><b>To: </b>"midPoint General Discussion" <midpoint@lists.evolveum.com><br><b>Cc: </b>"Tao Jiang" <t.jiang@unsw.edu.au><br><b>Sent: </b>Monday, February 21, 2022 7:14:05 AM<br><b>Subject: </b>[midPoint] Search look up table using Midpoint Java Rest Client 4.4<br></div><div><br><style>/*<![CDATA[*/p.MsoNormal, li.MsoNormal, div.MsoNormal {
        margin: 0.0cm;
        font-size: 11.0pt;
        font-family: Calibri , sans-serif;
}
a:link, span.MsoHyperlink {
        color: rgb(5,99,193);
        text-decoration: underline;
}
span.EmailStyle17 {
        font-family: Calibri , sans-serif;
        color: windowtext;
}
*.MsoChpDefault {
        font-family: Calibri , sans-serif;
}
div.WordSection1 {
        page: WordSection1;
}
/*]]>*/</style></div><div data-marker="__QUOTED_TEXT__">
<div class="WordSection1">
<p class="MsoNormal">Dear Midpoint community,</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">I have tried to use Midpoint Java Rest Client (version 4.4) to search Look up table using the code below:</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><b><span style="font-size:10pt;font-family:'consolas';color:#7f0055">public</span></b><span style="font-size:10pt;font-family:'consolas';color:black">
</span><b><span style="font-size:10pt;font-family:'consolas';color:#7f0055">void</span></b><span style="font-size:10pt;font-family:'consolas';color:black"> searchLookupTable()
</span><b><span style="font-size:10pt;font-family:'consolas';color:#7f0055">throws</span></b><span style="font-size:10pt;font-family:'consolas';color:black"> Exception {<!-- --></span><span style="font-size:10pt;font-family:'consolas'"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:'consolas';color:black">              Service
</span><span style="font-size:10pt;font-family:'consolas';color:#6a3e3e">service</span><span style="font-size:10pt;font-family:'consolas';color:black"> = getService();</span><span style="font-size:10pt;font-family:'consolas'"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:'consolas';color:black">              ItemPathType
</span><span style="font-size:10pt;font-family:'consolas';color:#6a3e3e">namePath</span><span style="font-size:10pt;font-family:'consolas';color:black"> =
</span><b><span style="font-size:10pt;font-family:'consolas';color:#7f0055">new</span></b><span style="font-size:10pt;font-family:'consolas';color:black"> ItemPathType();</span><span style="font-size:10pt;font-family:'consolas'"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:'consolas';color:black">             
</span><span style="font-size:10pt;font-family:'consolas';color:#6a3e3e">namePath</span><span style="font-size:10pt;font-family:'consolas';color:black">.setValue(</span><span style="font-size:10pt;font-family:'consolas';color:#2a00ff">"name"</span><span style="font-size:10pt;font-family:'consolas';color:black">);</span><span style="font-size:10pt;font-family:'consolas'"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:'consolas';color:black">              SearchResult<LookupTableType>
</span><span style="font-size:10pt;font-family:'consolas';color:#6a3e3e">result</span><span style="font-size:10pt;font-family:'consolas';color:black"> = (SearchResult<LookupTableType>)
</span><span style="font-size:10pt;font-family:'consolas';color:#6a3e3e">service</span><span style="font-size:10pt;font-family:'consolas';color:black">.lookupTables().search().queryFor(LookupTableType.</span><b><span style="font-size:10pt;font-family:'consolas';color:#7f0055">class</span></b><span style="font-size:10pt;font-family:'consolas';color:black">).item(</span><span style="font-size:10pt;font-family:'consolas';color:#6a3e3e">namePath</span><span style="font-size:10pt;font-family:'consolas';color:black">).eq(</span><span style="font-size:10pt;font-family:'consolas';color:#2a00ff">"UAC
 Lookup"</span><span style="font-size:10pt;font-family:'consolas';color:black">).get();</span><span style="font-size:10pt;font-family:'consolas'"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:'consolas';color:black">             
</span><span style="font-size:10pt;font-family:'consolas'"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:'consolas';color:black">       }</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:'consolas';color:black">                                    
</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:'consolas';color:black">The last statement ran into java.lang.NullPointerException. 
</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:'consolas';color:black">I can confirm the “UAC Lookup” look up table exists by execute the following query via curl command.</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:'consolas';color:black"><query xmlns=<a href="http://prism.evolveum.com/xml/ns/public/query-3" target="_blank" rel="nofollow noopener noreferrer">http://prism.evolveum.com/xml/ns/public/query-3</a>></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:'consolas';color:black">    <filter></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:'consolas';color:black">              <equal></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:'consolas';color:black">            <path>name</path></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:'consolas';color:black">            <value>UAC Lookup</value></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:'consolas';color:black">        </equal></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:'consolas';color:black">    </filter></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:'consolas';color:black"></query></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:'consolas';color:black"> </span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:'consolas';color:black">Could anyone tell me what’s wrong with the java code?</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:'consolas';color:black"> </span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:'consolas';color:black">Thank you very much in advance!</span></p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><span style="font-size:12pt;color:black">Kind regards,</span></p>
<p class="MsoNormal"><span style="font-size:12pt;color:black"> </span></p>
<p class="MsoNormal"><span style="font-size:12pt;color:black">Tao Jiang</span></p>
<p class="MsoNormal"><span style="font-size:12pt;color:black">UNSW IT</span></p>
<p class="MsoNormal"><span style="font-size:12pt;color:black">Email: <a href="mailto:t.jiang@unsw.edu.au" target="_blank" rel="nofollow noopener noreferrer">
<span style="color:#0563c1">t.jiang@unsw.edu.au</span></a></span></p>
<p class="MsoNormal"><span style="font-size:12pt;color:black">Phone: </span><span style="font-size:12pt;color:#252423;background:#fafafa">+61 2 9065 8771</span></p>
<p class="MsoNormal"> </p>
</div>

<br>_______________________________________________<br>midPoint mailing list<br>midPoint@lists.evolveum.com<br>https://lists.evolveum.com/mailman/listinfo/midpoint</div></div></body></html>