Project

General

Profile

Actions

Task #3425

closed

Updating a user fails in Moodle 4.1

Added by Alena Peterová over 1 year ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Alena Peterová
Target version:
Start date:
08/11/2023
Due date:
% Done:

100%

Estimated time:
Owner:

Description

After upgrading Moodle to version 4.1 from 3.8, updating the user or the user's password fails with the exception below.
The reason is that newer Moodle API returns a different response (at least) for the function core_user_update_users.
Originally, a response for success was:

null

Now it is
{"warnings":[]}

The exact body of the response is checked in the result of the UpdateUser method because even unsuccessful operations end with HTTP 200, so the body must be checked in all cases.

Improve the connector so that it is compatible also with newer API responses, and also improve logging of the response in case of an exception.


java.lang.IllegalArgumentException: can't parse argument number: "warnings":[]
    at java.text.MessageFormat.makeFormat(MessageFormat.java:1429)
    at java.text.MessageFormat.applyPattern(MessageFormat.java:479)
    at java.text.MessageFormat.<init>(MessageFormat.java:362)
    at java.text.MessageFormat.format(MessageFormat.java:840)
    at org.identityconnectors.common.logging.Log.log(Log.java:208)
    at org.identityconnectors.common.logging.Log.error(Log.java:286)
    at eu.bcvsolutions.idm.connector.moodle.communication.Connection.handleError(Connection.java:82)
    at eu.bcvsolutions.idm.connector.moodle.operation.UpdateUser.updateUser(UpdateUser.java:80)
    at eu.bcvsolutions.idm.connector.moodle.MoodleConnector.update(MoodleConnector.java:114)
    at org.identityconnectors.framework.impl.api.local.operations.UpdateImpl.update(UpdateImpl.java:101)
    at sun.reflect.GeneratedMethodAccessor2553.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.identityconnectors.framework.impl.api.local.operations.ConnectorAPIOperationRunnerProxy.invoke(ConnectorAPIOperationRunnerProxy.java:98)
    at com.sun.proxy.$Proxy544.update(Unknown Source)
    at sun.reflect.GeneratedMethodAccessor2553.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.identityconnectors.framework.impl.api.local.operations.ThreadClassLoaderManagerProxy.invoke(ThreadClassLoaderManagerProxy.java:96)
    at com.sun.proxy.$Proxy544.update(Unknown Source)
    at sun.reflect.GeneratedMethodAccessor2553.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.identityconnectors.framework.impl.api.DelegatingTimeoutProxy.invoke(DelegatingTimeoutProxy.java:99)
    at com.sun.proxy.$Proxy544.update(Unknown Source)
    at org.identityconnectors.framework.impl.api.AbstractConnectorFacade.update(AbstractConnectorFacade.java:190)
    at eu.bcvsolutions.idm.ic.connid.service.impl.ConnIdIcConnectorService.updateObject(ConnIdIcConnectorService.java:119)
    at eu.bcvsolutions.idm.ic.service.impl.DefaultIcConnectorFacade.updateObject(DefaultIcConnectorFacade.java:64)
    at eu.bcvsolutions.idm.acc.event.processor.provisioning.ProvisioningUpdateProcessor.processInternal(ProvisioningUpdateProcessor.java:63)
    at eu.bcvsolutions.idm.acc.event.processor.provisioning.AbstractProvisioningProcessor.process(AbstractProvisioningProcessor.java:146)
    at eu.bcvsolutions.idm.core.api.event.AbstractEntityEventProcessor.onApplicationEvent(AbstractEntityEventProcessor.java:239)
    at eu.bcvsolutions.idm.core.api.event.AbstractEntityEventProcessor$$FastClassBySpringCGLIB$$df69624d.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:749)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:93)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
    at eu.bcvsolutions.idm.acc.event.processor.provisioning.ProvisioningUpdateProcessor$$EnhancerBySpringCGLIB$$af7192dd.onApplicationEvent(<generated>)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:402)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:372)
    at eu.bcvsolutions.idm.core.model.service.impl.DefaultEntityEventManager.process(DefaultEntityEventManager.java:251)
    at eu.bcvsolutions.idm.core.model.service.impl.DefaultEntityEventManager.process(DefaultEntityEventManager.java:178)
    at eu.bcvsolutions.idm.core.model.service.impl.DefaultEntityEventManager$$FastClassBySpringCGLIB$$1694e58f.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:749)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:295)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
    at eu.bcvsolutions.idm.core.model.service.impl.DefaultEntityEventManager$$EnhancerBySpringCGLIB$$7b11e416.process(<generated>)
    at eu.bcvsolutions.idm.acc.service.impl.DefaultProvisioningExecutor$1.call(DefaultProvisioningExecutor.java:181)
    at eu.bcvsolutions.idm.acc.service.impl.DefaultProvisioningExecutor$1.call(DefaultProvisioningExecutor.java:177)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at eu.bcvsolutions.idm.core.config.DelegatingTransactionContextRunnable.run(DelegatingTransactionContextRunnable.java:39)
    at org.springframework.security.concurrent.DelegatingSecurityContextRunnable.run(DelegatingSecurityContextRunnable.java:84)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NumberFormatException: For input string: ""warnings":[]" 
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.lang.Integer.parseInt(Integer.java:569)
    at java.lang.Integer.parseInt(Integer.java:615)
    at java.text.MessageFormat.makeFormat(MessageFormat.java:1427)
    ... 60 more
Actions

Also available in: Atom PDF