<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">In your first example Groovy doesn't know that your next line continues the previous one. It's similar to Python in that new lines end statements. It evaluates `listeAffectations?.startsWith("HIE")` alone and then it tries to evaluate `|| listeAffectations?.startsWith("FUN")` which crashes because the interpreter doesn't understand how to handle || without anything to the left. When you switch the `||` positioning in your second example, Groovy is smart enough to look ahead and see something for it OR on the next line. </div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">If you want to write your ORs like you did in the first example (my preferred style as well) you can wrap the whole thing in parenthesis, and then Groovy will evaluate the whole block as one statement. </div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default"><font face="monospace">(listeAffectations?.startsWith("HIE")<br> || listeAffectations?.startsWith("FUN")<br> || listeAffectations?.startsWith("HOP")<br> || listeAffectations?.startsWith("ETU"))</font><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Apr 17, 2020 at 6:39 AM Pascal Perichon <<a href="mailto:pascal.perichon@parisdescartes.fr" target="_blank">pascal.perichon@parisdescartes.fr</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<p>Hello,</p>
<p>the following groovy script in the condition statement crash:<br>
</p>
<p><i><attribute id="20"></i><i><br>
</i><i> <c:ref
xmlns:ri=<a href="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3" target="_blank">"http://midpoint.evolveum.com/xml/ns/public/resource/instance-3"</a>>ri:supannEntiteAffectation</c:ref></i><i><br>
</i><i> <displayName>Affectation
Fonctionnelle</displayName></i><i><br>
</i><i> <limitations></i><i><br>
</i><i> <minOccurs>0</minOccurs></i><i><br>
</i><i> <maxOccurs>-1</maxOccurs></i><i><br>
</i><i> </limitations></i><i><br>
</i><i> <outbound></i><i><br>
</i><i> <strength>strong</strength></i><i><br>
</i><i> <source></i><i><br>
</i><i>
<c:path>$focus/extension/listeAffectations</c:path></i><i><br>
</i><i> <set></i><i><br>
</i><i> <condition></i><i><br>
</i><i> <script
xmlns:xsi=<a href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">"http://www.w3.org/2001/XMLSchema-instance"</a>
xmlns:c=<a href="http://midpoint.evolveum.com/xml/ns/public/common/common-3" target="_blank">"http://midpoint.evolveum.com/xml/ns/public/common/common-3"</a>
xsi:type="c:ScriptExpressionEvaluatorType"></i><i><br>
</i><i> <code></i><i><br>
</i><i><i>
listeAffectations?.startsWith("HIE") </i><i><br>
</i><i>
||
listeAffectations?.startsWith("FUN")</i><i><br>
</i><i>
||
listeAffectations?.startsWith("HOP")</i><i><br>
</i><i>
||
listeAffectations?.startsWith("ETU")</i><i><br>
</i><i>
</i> </code></i><i><br>
</i><i> </script></i><i><br>
</i><i> </condition></i><i><br>
</i><i> </set></i><i><br>
</i><i> </source></i></p>
<p><i> ...</i><i><br>
</i></p>
<p><i> </outbound></i></p>
<i></attribute></i><br>
<p><br>
</p>
<p>with the follwing error:</p>
<p><i>2020-04-17 11:45:09,219 [MODEL] [pool-3-thread-16] ERROR
(com.evolveum.midpoint.model.common.expression.script.ScriptExpression):
Expression error: Compilation error in (old) domain of
listeAffectations in mapping in outbound mapping for
{.../resource/instance-3}supannEntiteAffectation in
<a>resource:u75-connecteur-LDAP-UP(LDAP</a> UP): startup failed:</i><i><br>
</i><i>(old) domain of listeAffectations in mapping in outbound
mapping for {.../resource/instance-3}supannEntiteAffectation in
<a>resource:u75-connecteur-LDAP-UP(LDAP</a> UP): 3: unexpected token:
|| @ line 3, column 45.</i><i><br>
</i><i> || listeAf</i><i><br>
</i><i> ^</i><i><br>
</i><i><br>
</i><i>1 error</i><i><br>
</i></p>
<p><br>
</p>
<p>and this one works without problem (the same except that the '||'
are at the end of lines):<br>
</p>
<p><i><attribute id="20"></i><i><br>
</i><i>
<c:ref
xmlns:ri=<a href="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3" target="_blank">"http://midpoint.evolveum.com/xml/ns/public/resource/instance-3"</a>>ri:supannEntiteAffectation</c:ref></i><i><br>
</i><i>
<displayName>Affectation
Fonctionnelle</displayName></i><i><br>
</i><i>
<limitations></i><i><br>
</i><i>
<minOccurs>0</minOccurs></i><i><br>
</i><i>
<maxOccurs>-1</maxOccurs></i><i><br>
</i><i>
</limitations></i><i><br>
</i><i>
<outbound></i><i><br>
</i><i>
<strength>strong</strength></i><i><br>
</i><i>
<source></i><i><br>
</i><i>
<c:path>$focus/extension/listeAffectations</c:path></i><i><br>
</i><i>
<set></i><i><br>
</i><i>
<condition></i><i><br>
</i><i>
<script
xmlns:xsi=<a href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">"http://www.w3.org/2001/XMLSchema-instance"</a>
xmlns:c=<a href="http://midpoint.evolveum.com/xml/ns/public/common/common-3" target="_blank">"http://midpoint.evolveum.com/xml/ns/public/common/common-3"</a>
xsi:type="c:ScriptExpressionEvaluatorType"></i><i><br>
</i><i>
<code></i><i><br>
</i><i>
</i><i><i>
listeAffectations?.startsWith("HIE") ||</i><i><br>
</i><i>
listeAffectations?.startsWith("FUN") ||</i><i><br>
</i><i>
listeAffectations?.startsWith("HOP") ||</i><i><br>
</i><i>
listeAffectations?.startsWith("ETU")</i><i><br>
</i></i><i> </code></i><i><br>
</i><i>
</script></i><i><br>
</i><i>
</condition></i><i><br>
</i><i>
</set></i><i><br>
</i><i>
</source></i></p>
<i>
</i>
<p><i> ...</i><i><br>
</i>
</p>
<i>
</i>
<p><i> </outbound></i></p>
<i>
</attribute></i><br>
<p><br>
</p>
<p>
</p>
<p>Did I missed something ?</p>
<p>thanks<br>
</p>
</div>
_______________________________________________<br>
midPoint mailing list<br>
<a href="mailto:midPoint@lists.evolveum.com" target="_blank">midPoint@lists.evolveum.com</a><br>
<a href="https://lists.evolveum.com/mailman/listinfo/midpoint" rel="noreferrer" target="_blank">https://lists.evolveum.com/mailman/listinfo/midpoint</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr">Forest B. Crowley<div>Information Security </div><div><span style="font-size:12.8px">Lehigh University</span></div><div><span style="font-size:12.8px">610-758-3838</span><br></div></div></div></div></div></div></div></div></div></div></div>