<html><head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head><body bgcolor="#FFFFFF" text="#000000"><br>
Hi Karatina / Ivan -<br>
<br>
Many thanks for taking the time to look at this issue despite your busy
schedule.<br>
<br>
I worked on it a bit more this weekend and I have managed to "avoid" the
error - rather than figure out the root cause and I think I have to
stick with this for now in order to proceed with what I was originally
doing.<br>
<br>
It turns out that on my local environment (where this problem occurs) I
was using a 3.1-SNAPSHOT build of Midpoint against a 3.0 repository. I
am not sure what the consequences of this are (or whether the schema for
MySQL had any changes since 3.0 was released). But I did notice that
once I commented out the mapping below, other errors started appearing
(and strange exceptions such as "clob property type not supported for
...RRole" or something like that).<br>
<br>
So I reverted to a 3.0 build, reset my repository, redeployed everything
from scratch from a clean slate, and the error vanished (I wanted to
try this as a last resort). <br>
<br>
Thank you!<br>
<br>
BR/Deepak<br>
<blockquote style="border: 0px none;"
cite="mid:53A3D9B5.6090808@evolveum.com" type="cite">
<div style="margin:30px 25px 10px 25px;" class="__pbConvHr"><div
style="display:table;width:100%;border-top:1px solid
#EDEEF0;padding-top:5px"> <div
style="display:table-cell;vertical-align:middle;padding-right:6px;"><img
photoaddress="k.valalikova@evolveum.com" photoname="Katarina
Valalikova" src="cid:part1.04020605.05090006@trilobytesystems.com"
name="compose-unknown-contact.jpg" height="25px" width="25px"></div> <div
style="display:table-cell;white-space:nowrap;vertical-align:middle;width:100%">
<a moz-do-not-send="true" href="mailto:k.valalikova@evolveum.com"
style="color:#737F92
!important;padding-right:6px;font-weight:bold;text-decoration:none
!important;">Katarina Valalikova</a></div> <div
style="display:table-cell;white-space:nowrap;vertical-align:middle;">
<font color="#9FA2A5"><span style="padding-left:6px">June 20, 2014 at
9:50 AM</span></font></div></div></div>
<div style="color:#888888;margin-left:24px;margin-right:24px;"
__pbrmquotes="true" class="__pbConvBody">Hi Deepak,
<br>
<br>I tried to replicate your problem but without success. I tested it
with
revision v3.0.1devel-19-gb708da1 . As Ivan stated, maybe the logs will
be usefull to find out the reason.
<br>
<br>I used both of your mappings for tests. I added column "orgdesc"
into
the .csv file and fill it with different values (a/b/c, a/b, a, empty
value, copy&paste of your value). Then I run import accounts.
Accounts
were imported, users created and no exception was thrown.
<br>
<br>Regards,
<br>Katarina Valalikova
<br>
<br><br>
<br>_______________________________________________
<br>midPoint mailing list
<br><a class="moz-txt-link-abbreviated" href="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a>
<br><a class="moz-txt-link-freetext" href="http://lists.evolveum.com/mailman/listinfo/midpoint">http://lists.evolveum.com/mailman/listinfo/midpoint</a>
<br></div>
<div style="margin:30px 25px 10px 25px;" class="__pbConvHr"><div
style="display:table;width:100%;border-top:1px solid
#EDEEF0;padding-top:5px"> <div
style="display:table-cell;vertical-align:middle;padding-right:6px;"><img
photoaddress="ivan.noris@evolveum.com" photoname="Ivan Noris"
src="cid:part1.04020605.05090006@trilobytesystems.com"
name="compose-unknown-contact.jpg" height="25px" width="25px"></div> <div
style="display:table-cell;white-space:nowrap;vertical-align:middle;width:100%">
<a moz-do-not-send="true" href="mailto:ivan.noris@evolveum.com"
style="color:#737F92
!important;padding-right:6px;font-weight:bold;text-decoration:none
!important;">Ivan Noris</a></div> <div
style="display:table-cell;white-space:nowrap;vertical-align:middle;">
<font color="#9FA2A5"><span style="padding-left:6px">June 20, 2014 at
12:20 AM</span></font></div></div></div>
<div style="color:#888888;margin-left:24px;margin-right:24px;"
__pbrmquotes="true" class="__pbConvBody"><pre wrap="">Hi Deepak,
this is strange, by looking at:
</pre><blockquote type="cite"><pre wrap="">I fiddled around and changed it to this :
<ref>ri:orgdesc</ref>
<inbound>
<expression>
<script>
<code>
return input?.split("/")?.last()
</code>
</script>
</expression>
<target>
<path>$user/extension/apos:aposUnitAttributes</path>
</target>
</inbound>
</pre></blockquote><pre wrap=""><!---->
it should never fail on NPE because of the "?." operators...
</pre><blockquote type="cite"><pre wrap="">And it fails. The error is :
Caused by:
com.evolveum.midpoint.util.exception.ExpressionEvaluationException:
java.lang.NullPointerException: Cannot invoke method last() on null
object expression in mapping in inbound expression for
{<a class="moz-txt-link-freetext" href="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3">http://midpoint.evolveum.com/xml/ns/public/resource/instance-3</a>}orgdesc
in <a class="moz-txt-link-freetext" href="resource:036f0100-2fe8-49e1-a8fd-5548374f8703(APOS">resource:036f0100-2fe8-49e1-a8fd-5548374f8703(APOS</a> CSV Feeder
Resource Definition)
at
com.evolveum.midpoint.model.common.expression.script.jsr223.Jsr223ScriptEvaluator.evaluate(Jsr223ScriptEvaluator.java:124)
~[model-common-3.1-SNAPSHOT.jar:na]
at
com.evolveum.midpoint.model.common.expression.script.ScriptExpression.evaluate(ScriptExpression.java:108)
~[model-common-3.1-SNAPSHOT.jar:na]
at
com.evolveum.midpoint.model.common.expression.script.ScriptExpressionEvaluator.transformSingleValue(ScriptExpressionEvaluator.java:58)
~[model-common-3.1-SNAPSHOT.jar:na]
at
com.evolveum.midpoint.model.common.expression.evaluator.AbstractValueTransformationExpressionEvaluator$1.process(AbstractValueTransformationExpressionEvaluator.java:420)
~[model-common-3.1-SNAPSHOT.jar:na]
... 50 common frames omitted
Caused by: javax.script.ScriptException: java.lang.NullPointerException:
Cannot invoke method last() on null object
at
org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:323)
~[groovy-1.8.6.jar:1.8.6]
at
org.codehaus.groovy.jsr223.GroovyCompiledScript.eval(GroovyCompiledScript.java:41)
~[groovy-1.8.6.jar:1.8.6]
at javax.script.CompiledScript.eval(CompiledScript.java:92)
~[na:1.7.0_45]
at
com.evolveum.midpoint.model.common.expression.script.jsr223.Jsr223ScriptEvaluator.evaluate(Jsr223ScriptEvaluator.java:122)
~[model-common-3.1-SNAPSHOT.jar:na]
... 53 common frames omitted
Caused by: java.lang.NullPointerException: Cannot invoke method last()
on null object
at
org.codehaus.groovy.runtime.NullObject.invokeMethod(NullObject.java:77)
~[groovy-1.8.6.jar:1.8.6]
at
org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:45)
~[groovy-1.8.6.jar:1.8.6]
at
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
~[groovy-1.8.6.jar:1.8.6]
at
org.codehaus.groovy.runtime.callsite.NullCallSite.call(NullCallSite.java:32)
~[groovy-1.8.6.jar:1.8.6]
at
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
~[groovy-1.8.6.jar:1.8.6]
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
~[groovy-1.8.6.jar:1.8.6]
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
~[groovy-1.8.6.jar:1.8.6]
at Script4.run(Script4.groovy:3) ~[na:na]
at
org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:320)
~[groovy-1.8.6.jar:1.8.6]
... 56 common frames omitted
I actually have another installation of Midpoint 3.0 where this is
running and working correctly (I haven't touched this mapping in ages).
Is there anything that could break this in the latest version?
Thanks!
BR/deepak
</pre></blockquote><pre wrap=""><!---->
Please turn on your mapping and expression tracing (on Logging
configuration page in standard loggers) and then try to RESTART your
midpoint (application server). I'm trying to differentiate if this could
be some strange expression caching bug (there was something similar in
April).
Related to this: have you enhanced this expression (in Groovy) by the
"?." operators, or have you used them in this specific expression since
the very beginning?
(because the last() method should not be called on null object at all in
this setup)
This is still just my wild guess; coleagues are already trying to
replicate this.
Regards,
Ivan
</pre></div>
<div style="margin:30px 25px 10px 25px;" class="__pbConvHr"><div
style="display:table;width:100%;border-top:1px solid
#EDEEF0;padding-top:5px"> <div
style="display:table-cell;vertical-align:middle;padding-right:6px;"><img
photoaddress="dnataraj@trilobytesystems.com" photoname="Deepak
Natarajan" src="cid:part1.04020605.05090006@trilobytesystems.com"
name="compose-unknown-contact.jpg" height="25px" width="25px"></div> <div
style="display:table-cell;white-space:nowrap;vertical-align:middle;width:100%">
<a moz-do-not-send="true"
href="mailto:dnataraj@trilobytesystems.com" style="color:#737F92
!important;padding-right:6px;font-weight:bold;text-decoration:none
!important;">Deepak Natarajan</a></div> <div
style="display:table-cell;white-space:nowrap;vertical-align:middle;">
<font color="#9FA2A5"><span style="padding-left:6px">June 18, 2014 at
12:26 PM</span></font></div></div></div>
<div style="color:#888888;margin-left:24px;margin-right:24px;"
__pbrmquotes="true" class="__pbConvBody"><div>Hi Everyone -<br><br>I
just deployed the latest build and one of my inbound mappings from a<br>CSV
resource is failing :<br><br> <attribute><br>
<ref>ri:orgdesc</ref><br>
<inbound><br> <expression><br>
<script><br> <br><language><a class="moz-txt-link-freetext" href="http://www.w3.org/TR/xpath/">http://www.w3.org/TR/xpath/</a></language><br>
<code><br>
tokenize($c:input,"/")[last()]<br>
</code><br> </script><br>
</expression><br>
<target><br> <br><path>$user/extension/apos:aposUnitAttributes</path><br>
</target><br>
</inbound><br> </attribute><br><br>Caused by:
java.lang.RuntimeException:<br>null({.../common/common-3}input=PPV(String:/NVK,99999/AV,38/VoksPsyk,43/VoksSociMis,71/,1070/VMNR,959);<br>)
in expression<br> in mapping in inbound expression for<br>{<a class="moz-txt-link-freetext" href="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3">http://midpoint.evolveum.com/xml/ns/public/resource/instance-3</a>}orgdesc<br>in
<a class="moz-txt-link-freetext" href="resource:036f0100-2fe8-49e1-a8fd-5548374f8703">resource:036f0100-2fe8-49e1-a8fd-5548374f8703</a><br>(APOS CSV Feeder
Resource Definition)<br> at<br>com.evolveum.midpoint.model.common.expression.evaluator.AbstractValueTransformationExpressionEvaluator$1.process(AbstractValueTransformationExpress<br>ionEvaluator.java:432)
~[model-common-3.1-SNAPSHOT.jar:na]<br> at<br>com.evolveum.midpoint.model.common.expression.evaluator.AbstractValueTransformationExpressionEvaluator$1.process(AbstractValueTransformationExpress<br>ionEvaluator.java:350)
~[model-common-3.1-SNAPSHOT.jar:na]<br> at<br>com.evolveum.midpoint.util.MiscUtil.carthesian(MiscUtil.java:285)<br>~[util-3.1-SNAPSHOT.jar:na]<br>
at<br>com.evolveum.midpoint.util.MiscUtil.carthesian(MiscUtil.java:275)<br>~[util-3.1-SNAPSHOT.jar:na]<br>
at<br>com.evolveum.midpoint.model.common.expression.evaluator.AbstractValueTransformationExpressionEvaluator.evaluateRelativeExpression(AbstractValueTransformationExpressionEvaluator.java:440)<br>~[model-common-3.1-SNAPSHOT.jar:na]<br>
at<br>com.evolveum.midpoint.model.common.expression.evaluator.AbstractValueTransformationExpressionEvaluator.evaluate(AbstractValueTransformationExpressionEvaluator.java:112)<br>~[model-common-3.1-SNAPSHOT.jar:na]<br>
at<br>com.evolveum.midpoint.model.common.expression.Expression.evaluate(Expression.java:136)<br>~[model-common-3.1-SNAPSHOT.jar:na]<br>
at<br>com.evolveum.midpoint.model.common.mapping.Mapping.evaluateExpression(Mapping.java:967)<br>~[model-common-3.1-SNAPSHOT.jar:na]<br>
at<br>com.evolveum.midpoint.model.common.mapping.Mapping.evaluate(Mapping.java:501)<br>~[model-common-3.1-SNAPSHOT.jar:na]<br>
at<br>com.evolveum.midpoint.model.impl.lens.LensUtil.evaluateMapping(LensUtil.java:563)<br>~[model-impl-3.1-SNAPSHOT.jar:na]<br>
at<br>com.evolveum.midpoint.model.impl.lens.projector.InboundProcessor.evaluateInboundMapping(InboundProcessor.java:386)<br>~[model-impl-3.1-SNAPSHOT.jar:na]<br>
at<br>com.evolveum.midpoint.model.impl.lens.projector.InboundProcessor.processInboundExpressionsForAccount(InboundProcessor.java:248)<br>~[model-impl-3.1-SNAPSHOT.jar:na]<br>
at<br>com.evolveum.midpoint.model.impl.lens.projector.InboundProcessor.processInboundFocal(InboundProcessor.java:167)<br>~[model-impl-3.1-SNAPSHOT.jar:na]<br>
at<br>com.evolveum.midpoint.model.impl.lens.projector.InboundProcessor.processInbound(InboundProcessor.java:113)<br>~[model-impl-3.1-SNAPSHOT.jar:na]<br>
at<br>com.evolveum.midpoint.model.impl.lens.projector.FocusProcessor.processFocusFocus(FocusProcessor.java:265)<br>~[model-impl-3.1-SNAPSHOT.jar:na]<br>
at<br>com.evolveum.midpoint.model.impl.lens.projector.FocusProcessor.processFocus(FocusProcessor.java:180)<br>~[model-impl-3.1-SNAPSHOT.jar:na]<br><br>I
fiddled around and changed it to this :<br><br>
<ref>ri:orgdesc</ref><br> <inbound><br>
<expression><br>
<script><br> <code><br>
return input?.split("/")?.last()<br>
</code><br>
</script><br> </expression><br>
<target><br> <br><path>$user/extension/apos:aposUnitAttributes</path><br>
</target><br>
</inbound><br><br>And it fails. The error is :<br><br>Caused by:<br>com.evolveum.midpoint.util.exception.ExpressionEvaluationException:<br>java.lang.NullPointerException:
Cannot invoke method last() on null<br>object expression in mapping in
inbound expression for<br>{<a class="moz-txt-link-freetext" href="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3">http://midpoint.evolveum.com/xml/ns/public/resource/instance-3</a>}orgdesc<br>in
<a class="moz-txt-link-freetext" href="resource:036f0100-2fe8-49e1-a8fd-5548374f8703(APOS">resource:036f0100-2fe8-49e1-a8fd-5548374f8703(APOS</a> CSV Feeder<br>Resource
Definition)<br> at<br>com.evolveum.midpoint.model.common.expression.script.jsr223.Jsr223ScriptEvaluator.evaluate(Jsr223ScriptEvaluator.java:124)<br>~[model-common-3.1-SNAPSHOT.jar:na]<br>
at<br>com.evolveum.midpoint.model.common.expression.script.ScriptExpression.evaluate(ScriptExpression.java:108)<br>~[model-common-3.1-SNAPSHOT.jar:na]<br>
at<br>com.evolveum.midpoint.model.common.expression.script.ScriptExpressionEvaluator.transformSingleValue(ScriptExpressionEvaluator.java:58)<br>~[model-common-3.1-SNAPSHOT.jar:na]<br>
at<br>com.evolveum.midpoint.model.common.expression.evaluator.AbstractValueTransformationExpressionEvaluator$1.process(AbstractValueTransformationExpressionEvaluator.java:420)<br>~[model-common-3.1-SNAPSHOT.jar:na]<br>
... 50 common frames omitted<br>Caused by:
javax.script.ScriptException: java.lang.NullPointerException:<br>Cannot
invoke method last() on null object<br> at<br>org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:323)<br>~[groovy-1.8.6.jar:1.8.6]<br>
at<br>org.codehaus.groovy.jsr223.GroovyCompiledScript.eval(GroovyCompiledScript.java:41)<br>~[groovy-1.8.6.jar:1.8.6]<br>
at javax.script.CompiledScript.eval(CompiledScript.java:92)<br>~[na:1.7.0_45]<br>
at<br>com.evolveum.midpoint.model.common.expression.script.jsr223.Jsr223ScriptEvaluator.evaluate(Jsr223ScriptEvaluator.java:122)<br>~[model-common-3.1-SNAPSHOT.jar:na]<br>
... 53 common frames omitted<br>Caused by:
java.lang.NullPointerException: Cannot invoke method last()<br>on null
object<br> at<br>org.codehaus.groovy.runtime.NullObject.invokeMethod(NullObject.java:77)<br>~[groovy-1.8.6.jar:1.8.6]<br>
at<br>org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:45)<br>~[groovy-1.8.6.jar:1.8.6]<br>
at<br>org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)<br>~[groovy-1.8.6.jar:1.8.6]<br>
at<br>org.codehaus.groovy.runtime.callsite.NullCallSite.call(NullCallSite.java:32)<br>~[groovy-1.8.6.jar:1.8.6]<br>
at<br>org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)<br>~[groovy-1.8.6.jar:1.8.6]<br>
at<br>org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)<br>~[groovy-1.8.6.jar:1.8.6]<br>
at<br>org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)<br>~[groovy-1.8.6.jar:1.8.6]<br>
at Script4.run(Script4.groovy:3) ~[na:na]<br> at<br>org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:320)<br>~[groovy-1.8.6.jar:1.8.6]<br>
... 56 common frames omitted<br><br>I actually have another
installation of Midpoint 3.0 where this is<br>running and working
correctly (I haven't touched this mapping in ages).<br><br>Is there
anything that could break this in the latest version?<br><br>Thanks!<br><br>BR/deepak<br><br><br><br><br></div></div>
</blockquote>
<br>
<div class="moz-signature">-- <br>Deepak Natarajan<br>
Director<br>
<br>
Trilobyte Systems ApS<br>
<br>
Falkoner Alle 1, 3 Frederikinkatu 61A, 6th Floor<br>
2000 Frederiksberg Business Center Papula<br>
Denmark
00100 Helsinki<br>
Finland<br>
<br>
Tel : +45 29375068<br>
<a class="moz-txt-link-freetext" href="http://www.trilobytesystems.com">http://www.trilobytesystems.com</a><br>
<br>
<br>
</div>
</body></html>