<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Hello Patrick,</p>
    <p>thank you for the report and fix. I've added it to the code.</p>
    <p>Yes, we've been dealing with these "prismContext is null" issues
      some time ago - a lot. These are related to how tomcat serializes
      and deserializes objects, as prismContext is not serializable and
      has to be filled-in explicitly if it's missing. <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 22.09.2016 0:03, <a class="moz-txt-link-abbreviated" href="mailto:pdbogen@cernu.us">pdbogen@cernu.us</a>
      wrote:<br>
    </div>
    <blockquote cite="mid:20160921220349.GA1942@cernu.us" type="cite">
      <pre wrap="">Hi!

This is a strange bug report, and once you read it hopefully you'll understand 
why I didn't immediately open a ticket. (tl;dr: I encountered it, but I can't 
figure out how to reproduce it.)

While fine-tuning my approval workflows, I ran across a situation wherein 
approving a work item failed.

I apologize that I've now lost the full stack trace, but I tracked the error 
down to this line:

    <a class="moz-txt-link-freetext" href="https://github.com/Evolveum/midpoint/blob/master/model/workflow-impl/src/main/java/com/evolveum/midpoint/wf/impl/processes/itemApproval/ApprovalLevelImpl.java#L123">https://github.com/Evolveum/midpoint/blob/master/model/workflow-impl/src/main/java/com/evolveum/midpoint/wf/impl/processes/itemApproval/ApprovalLevelImpl.java#L123</a>

I'm not sure why, and so I cannot now reproduce, but sometimes the 
PrismContext for the deserialized approverExpression is null. In such a case, 
getValue throws an exception; and long story short, the approval of the work 
item fails.

While the problem was occuring, I was able to fix it by copying the code from 
just below, 
<a class="moz-txt-link-freetext" href="https://github.com/Evolveum/midpoint/blob/master/model/workflow-impl/src/main/java/com/evolveum/midpoint/wf/impl/processes/itemApproval/ApprovalLevelImpl.java#L142">https://github.com/Evolveum/midpoint/blob/master/model/workflow-impl/src/main/java/com/evolveum/midpoint/wf/impl/processes/itemApproval/ApprovalLevelImpl.java#L142</a>, 
which checks for a null PrismContext for automaticallyApproved and sets it if 
it is null.

I guess therefore this is a known problem, but an oversight that this check 
was not also done for the approverExpressions.

I've attached a simple patch that adds this check in, which fixed the problem 
for me. But, as mentioned, I don't know how to reproduce it..

Thanks!
</pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <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>
    <br>
  </body>
</html>