[midPoint] Working with schema handling expressions

Tim.Strong at sita.aero Tim.Strong at sita.aero
Fri Jul 31 21:19:54 CEST 2015


Hi folks,
I'm doing some scripting on an inbound attribute that will never be null 
and I'm trying to understand why the expression fails if I do not check 
for a string first.

This works...
<code>
           String result = basic.stringify(input)?.size() > 0 ? 
basic.stringify(input).substring(0, 
basic.stringify(input).indexOf('@')):'';
           return result;
 </code>


And this does *not* work...
<code>
        String result = basic.stringify(input).substring(0, 
basic.stringify(input).indexOf('@'));
        return result;
</code>
... claiming the input variable is null.

I know it's best to always check if something exists before doing an 
operation on it, but I'm curious as to why it fails in this case if I do 
not check.   I'm executing against the same test set of accounts both 
times, and they all have the attribute in question.

Thanks
Tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20150731/59f456be/attachment.htm>


More information about the midPoint mailing list