[midPoint] Trouble deleting user (v3.7.2)

Ivan Noris ivan.noris at evolveum.com
Wed Jun 27 09:17:41 CEST 2018


Wojciech,

this might be a result of your groovy construction:

def (firstfamilyname, secondfamilyname) =
user?.getFamilyName()?.toString()?.tokenize('-')

This will throw NPE when user is null.


java.lang.NullPointerException: Cannot invoke method getAt() on null object
	at Script1.run(Script1.groovy:3)

You can check using http://groovyconsole.appspot.com/

You cannot set the two variables using tokenize if the user is null.

I would suggest to check user object first and not run anything else in
case of delete.

Best regards,

Ivan


On 26.06.2018 23:07, Wojciech Staszewski wrote:
> Hello!
>
> I try to delete user but I get an error.
> The error comes from pre-iteration expression of one of assigned resources.
>
> Error:
> Couldn't delete user.
> Message
> java.lang.NullPointerException: Cannot invoke method getAt() on null
> object in (new) pre-iteration expression in account(ID
> {.../connector/icf-1/resource-schema-3}uid = [ 94740706 ], type 'AAA',
> resource:xxx-oid-xxx(resource name))
> Parameters
> options   
> [ModelExecuteOptions(executeImmediatelyAfterApproval=false,force=false,reconcile=false,reconcileAffected=false)]
> Error
> java.lang.NullPointerException: Cannot invoke method getAt() on null
> object in (new) pre-iteration expression in account(ID
> {.../connector/icf-1/resource-schema-3}uid = [ 94740706 ], type 'AAA',
> resource:xxx-oid-xxx(resource name))
>
> I have no "getAt()" method in the expression.
> The pre-iteration expression:
>
>             <preIterationCondition>
>                <variable>
>                   <name>firstname</name>
>                   <c:path>$shadow/attributes/ri:firstname</c:path>
>                </variable>
>                <variable>
>                   <name>surname</name>
>                   <c:path>$shadow/attributes/ri:surname</c:path>
>                </variable>
>                <variable>
>                   <name>login</name>
>                   <c:path>$shadow/attributes/ri:login</c:path>
>                </variable>
>                <script xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>                        xsi:type="c:ScriptExpressionEvaluatorType">
>                   <code>
>                       def (firstfamilyname,secondfamilyname) =
> user?.getFamilyName()?.toString()?.tokenize('-');
>             def templogin =
> basic.norm(user?.getGivenName()?.toString()?.replace("Ł","L")?.replace("ł","l")?.toString()?.take(1))?.toUpperCase()
> +
> basic.norm(firstfamilyname?.replace("Ł","L")?.replace("ł","l"))?.toString()?.toUpperCase()
> + iterationToken;
>             return midpoint.isUniqueAccountValue(resource, shadow,
> 'login', templogin);
>         </code>
>                </script>
>             </preIterationCondition>
>
> This expression takes first letter of the user given name, whole first
> family name (both normalized), example: Anna Smith-Wilson = ASMITH and
> checks if this calculated login exists in the resource.
>
> The resource has "disable instead delete" mechanism applied taken from
> training labs materials.
>
> Questions:
>
> 1) Why midPoint tries to delete account from this resource instead
> disable and unassign it (disable instead delete)?
> 2) Why midPoint runs the pre-iteration condition on delete operation?
> Isn't it a create operation specific expression?
> 3) Where to find getAt() method, as it is not present in the expression?
>
> Thanks!
> Wojciech Staszewski
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> http://lists.evolveum.com/mailman/listinfo/midpoint

-- 
Ivan Noris
Senior Identity Engineer
evolveum.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20180627/fc1d620b/attachment.htm>


More information about the midPoint mailing list