<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Hello Jan,</p>
<p>this kind of exceptions (i.e. NPE related to prism context being
null) has been beating me for years.</p>
<p>Generally, is issue occurs when Wicket serializes and then
deserializes content of a page and then invokes a method to do
something.</p>
<p>A quite universal way of preventing it is to call adopt() method
on any objects that could have come from such deserialization.<br>
</p>
<p>An example: <a moz-do-not-send="true"
href="https://github.com/Evolveum/midpoint/blob/8eac39e2553501a59221ba7a13afc4b13a7dff88/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageUser.java#L418">https://github.com/Evolveum/midpoint/blob/8eac39e2553501a59221ba7a13afc4b13a7dff88/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageUser.java#L418</a></p>
<p>Here the "user" comes from delegationsModel.getObject() that can
be possibly serialized and deserialized, because it's part of a
page.</p>
<p>At least this is how I understand it. I try to avoid messing with
GUI as much as I can. :-)<br>
</p>
<p>Best regards,<br>
</p>
<pre class="moz-signature" cols="72">Pavol Mederly
Software developer
evolveum.com
</pre>
<div class="moz-cite-prefix">On 11.10.2019 15:01, Jan Vaňáček - AMI
Praha a.s. wrote:<br>
</div>
<blockquote type="cite"
cite="mid:26b21041f60ea4decf17c88026037b56@mail.gmail.com">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
span.StylE-mailovZprvy17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style>
<div class="WordSection1">
<p class="MsoNormal">Hi guys,</p>
<p class="MsoNormal">I am using midPoint 3.7 support and l am
looking into NPE connected with prismContext and I am a little
bit getting frustrated since I have no idea how to find root
cause.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">This NPE occurs when computing
authorizations for Org tree.</p>
<p class="MsoNormal">I have an authorization (for deleting
subunits):</p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;font-family:Consolas;color:teal"><</span><span
style="font-size:10.0pt;font-family:Consolas;color:#3f7f7f;background:silver">authorization</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal">></span><span
style="font-size:10.0pt;font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;font-family:Consolas;color:black">
</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal"><</span><span
style="font-size:10.0pt;font-family:Consolas;color:#3f7f7f">name</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal">></span><u><span
style="font-size:10.0pt;font-family:Consolas;color:black">org</span></u><span
style="font-size:10.0pt;font-family:Consolas;color:black">-delete-subunit</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal"></</span><span
style="font-size:10.0pt;font-family:Consolas;color:#3f7f7f">name</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal">></span><span
style="font-size:10.0pt;font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;font-family:Consolas;color:black">
</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal"><</span><span
style="font-size:10.0pt;font-family:Consolas;color:#3f7f7f">action</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal">></span><span
style="font-size:10.0pt;font-family:Consolas;color:black"><a
href="http://midpoint.evolveum.com/xml/ns/public/security/authorization-model-3#delete"
moz-do-not-send="true">http://midpoint.evolveum.com/xml/ns/public/security/authorization-model-3#delete</a></span><span
style="font-size:10.0pt;font-family:Consolas;color:teal"></</span><span
style="font-size:10.0pt;font-family:Consolas;color:#3f7f7f">action</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal">></span><span
style="font-size:10.0pt;font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;font-family:Consolas;color:black">
</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal"><</span><span
style="font-size:10.0pt;font-family:Consolas;color:#3f7f7f">object</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal">></span><span
style="font-size:10.0pt;font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;font-family:Consolas;color:black">
</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal"><</span><span
style="font-size:10.0pt;font-family:Consolas;color:#3f7f7f">type</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal">></span><span
style="font-size:10.0pt;font-family:Consolas;color:black">OrgType</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal"></</span><span
style="font-size:10.0pt;font-family:Consolas;color:#3f7f7f">type</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal">></span><span
style="font-size:10.0pt;font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;font-family:Consolas;color:black">
</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal"><</span><span
style="font-size:10.0pt;font-family:Consolas;color:#3f7f7f">orgRelation</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal">></span><span
style="font-size:10.0pt;font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;font-family:Consolas;color:black">
</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal"><</span><span
style="font-size:10.0pt;font-family:Consolas;color:#3f7f7f">subjectRelation</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal">></span><span
style="font-size:10.0pt;font-family:Consolas;color:black">org:manager</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal"></</span><span
style="font-size:10.0pt;font-family:Consolas;color:#3f7f7f">subjectRelation</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal">></span><span
style="font-size:10.0pt;font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;font-family:Consolas;color:black">
</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal"><</span><span
style="font-size:10.0pt;font-family:Consolas;color:#3f7f7f">scope</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal">></span><span
style="font-size:10.0pt;font-family:Consolas;color:black">allDescendants</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal"></</span><span
style="font-size:10.0pt;font-family:Consolas;color:#3f7f7f">scope</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal">></span><span
style="font-size:10.0pt;font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;font-family:Consolas;color:black">
</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal"><</span><span
style="font-size:10.0pt;font-family:Consolas;color:#3f7f7f">includeReferenceOrg</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal">></span><span
style="font-size:10.0pt;font-family:Consolas;color:black">true</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal"></</span><span
style="font-size:10.0pt;font-family:Consolas;color:#3f7f7f">includeReferenceOrg</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal">></span><span
style="font-size:10.0pt;font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;font-family:Consolas;color:black">
</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal"></</span><span
style="font-size:10.0pt;font-family:Consolas;color:#3f7f7f">orgRelation</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal">></span><span
style="font-size:10.0pt;font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;font-family:Consolas;color:black">
</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal"><</span><span
style="font-size:10.0pt;font-family:Consolas;color:#3f7f7f">filter</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal">></span><span
style="font-size:10.0pt;font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;font-family:Consolas;color:black">
</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal"><</span><span
style="font-size:10.0pt;font-family:Consolas;color:#3f7f7f">q:equal</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal">></span><span
style="font-size:10.0pt;font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;font-family:Consolas;color:black">
</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal"><</span><span
style="font-size:10.0pt;font-family:Consolas;color:#3f7f7f">q:path</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal">></span><span
style="font-size:10.0pt;font-family:Consolas;color:black">orgType</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal"></</span><span
style="font-size:10.0pt;font-family:Consolas;color:#3f7f7f">q:path</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal">></span><span
style="font-size:10.0pt;font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;font-family:Consolas;color:black">
</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal"><</span><span
style="font-size:10.0pt;font-family:Consolas;color:#3f7f7f">q:value</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal">></span><span
style="font-size:10.0pt;font-family:Consolas;color:black">ROLE_FOLDER</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal"></</span><span
style="font-size:10.0pt;font-family:Consolas;color:#3f7f7f">q:value</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal">></span><span
style="font-size:10.0pt;font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;font-family:Consolas;color:black">
</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal"></</span><span
style="font-size:10.0pt;font-family:Consolas;color:#3f7f7f">q:equal</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal">></span><span
style="font-size:10.0pt;font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;font-family:Consolas;color:black">
</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal"></</span><span
style="font-size:10.0pt;font-family:Consolas;color:#3f7f7f">filter</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal">></span><span
style="font-size:10.0pt;font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
style="font-size:10.0pt;font-family:Consolas;color:black">
</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal"></</span><span
style="font-size:10.0pt;font-family:Consolas;color:#3f7f7f">object</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal">></span><span
style="font-size:10.0pt;font-family:Consolas"></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:Consolas;color:teal"></</span><span
style="font-size:10.0pt;font-family:Consolas;color:#3f7f7f;background:silver">authorization</span><span
style="font-size:10.0pt;font-family:Consolas;color:teal">></span></p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">When I click into Org. structure and then I
click on any item in a tree (including root org)
authorizations will be computed.</p>
<p class="MsoNormal">But when it gets to computing root org
object. It invokes object.getPrismContext() which is null
resulting in Error 500: <i>org.apache.wicket.WicketRuntimeException:
Error attaching this container for rendering: [ListView
[Component id = menuItem]]</i></p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">When I try to click (compute) it for the
second time it is OK. But then it occures sometimes again
(especially when I log out and log in, but it depends –
sometimes it is just on the 10th attempt, sometimes on the 2nd
attempt) </p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">I noticed that in
com.evolveum.midpoint.prism.Item is mentioned: „beware, this
one can easily be null“, but in QueryJaxbConvertor it is not
checked for null…</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Is there any way how to make sure that
there always be prismContext for a root org? Or what else
should I check?</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b><span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black">Jan Vaňáček</span></b><span
style="font-size:8.5pt;font-family:"Arial",sans-serif;color:black"><br>
JAVA programátor<br>
<br>
gsm: [+420] 734 510 214<br>
e-mail: <a href="mailto:jan.vanacek@ami.cz" target="_blank"
moz-do-not-send="true"><span style="color:blue">jan.vanacek@ami.cz</span></a></span></p>
<table class="MsoNormalTable"
style="width:375.0pt;border-collapse:collapse" width="500"
cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr>
<td style="width:375.0pt;padding:0cm 0cm 0cm 0cm"
width="500" valign="bottom">
<p class="MsoNormal"><b><span
style="font-size:8.5pt;font-family:"Arial",sans-serif;color:black;border:none
windowtext 1.0pt;padding:0cm">AMI Praha a.s.</span></b><span
style="font-size:8.5pt;font-family:"Arial",sans-serif;color:black"><br>
Pláničkova 11, 162 00 Praha 6</span></p>
</td>
</tr>
<tr style="height:9.5pt">
<td style="width:375.0pt;padding:0cm 0cm 0cm
0cm;height:9.5pt" width="500" valign="bottom">
<p class="MsoNormal"><span
style="font-size:8.5pt;font-family:"Arial",sans-serif;color:black"> </span></p>
</td>
</tr>
<tr>
<td style="width:375.0pt;padding:0cm 0cm 0cm 0cm"
width="500" valign="bottom">
<p class="MsoNormal"><span
style="font-size:8.5pt;font-family:"Arial",sans-serif;color:black">tel.:
[+420] 274 783 239 | web: <a
href="http://www.ami.cz/" moz-do-not-send="true"><span
style="color:#0066cc;border:none windowtext
1.0pt;padding:0cm">www.ami.cz</span></a></span></p>
</td>
</tr>
<tr style="height:9.5pt">
<td style="width:375.0pt;padding:0cm 0cm 0cm
0cm;height:9.5pt" width="500" valign="bottom">
<p class="MsoNormal"><span
style="font-size:8.5pt;font-family:"Arial",sans-serif;color:black"> </span></p>
</td>
</tr>
<tr>
<td style="width:375.0pt;padding:0cm 0cm 0cm 0cm"
width="500" valign="bottom">
<p class="MsoNormal"><span
style="font-size:8.5pt;font-family:"Arial",sans-serif;color:black"><img
style="width:1.0833in;height:.4166in"
id="Obrázek_x0020_5"
src="cid:part5.AFFC9789.CDA82B16@evolveum.com"
alt="AMI Praha a.s." class="" width="104"
height="40" border="0"></span></p>
</td>
</tr>
<tr style="height:9.5pt">
<td style="width:375.0pt;padding:0cm 0cm 0cm
0cm;height:9.5pt" width="500" valign="bottom">
<p class="MsoNormal"><span
style="font-size:8.5pt;font-family:"Arial",sans-serif;color:black"> </span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><span
style="font-size:8.5pt;font-family:"Arial",sans-serif;color:#aaaaaa">Textem
tohoto e‑mailu podepisující neslibuje uzavřít ani neuzavírá
za společnost AMI Praha a.s.</span><span
style="mso-fareast-language:CS"><br>
</span><span
style="font-size:8.5pt;font-family:"Arial",sans-serif;color:#aaaaaa">jakoukoliv
smlouvu. Každá smlouva, pokud bude uzavřena, musí mít
výhradně písemnou formu.</span><span
style="mso-fareast-language:CS"><br>
</span><span
style="font-size:4.0pt;font-family:"Arial",sans-serif"> </span><span
style="font-size:8.5pt;font-family:"Arial",sans-serif;color:#aaaaaa"><br>
Tento e‑mail je určen výhradně pro potřeby jeho adresáta/ů
a může obsahovat důvěrné nebo osobní<br>
informace. Nejste‑li zamýšleným příjemcem, je zakázáno
jakékoliv zveřejňování, zprostředkování<br>
nebo jiné použití těchto informací. Pokud jste obdrželi
e‑mail neoprávněně, informujte o tom prosím<br>
odesílatele a vymažte neprodleně všechny kopie tohoto
e‑mailu včetně všech jeho příloh. Nakládáním<br>
s neoprávněně získanými informacemi se vystavujete riziku
právního postihu.</span><span
style="mso-fareast-language:CS"></span></p>
<p class="MsoNormal"> </p>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
midPoint mailing list
<a class="moz-txt-link-abbreviated" href="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a>
<a class="moz-txt-link-freetext" href="http://lists.evolveum.com/mailman/listinfo/midpoint">http://lists.evolveum.com/mailman/listinfo/midpoint</a>
</pre>
</blockquote>
</body>
</html>