You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@syncope.apache.org by "Francesco Chicchiriccò (JIRA)" <ji...@apache.org> on 2019/01/29 07:52:00 UTC
[jira] [Updated] (SYNCOPE-1430) ItemTransformer for Date schemas
throws NPE
[ https://issues.apache.org/jira/browse/SYNCOPE-1430?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Francesco Chicchiriccò updated SYNCOPE-1430:
--------------------------------------------
Summary: ItemTransformer for Date schemas throws NPE (was: ItemTransformer for non-String schemas throws NPE )
> ItemTransformer for Date schemas throws NPE
> --------------------------------------------
>
> Key: SYNCOPE-1430
> URL: https://issues.apache.org/jira/browse/SYNCOPE-1430
> Project: Syncope
> Issue Type: Bug
> Components: core
> Affects Versions: 2.0.12, 2.1.3
> Reporter: Andrea Patricelli
> Assignee: Francesco Chicchiriccò
> Priority: Major
> Fix For: 2.0.13, 2.1.4, 3.0.0
>
>
> # Login as admin to console
> # Define a connector and a resource (say resource-ldap on embedded mode).
> # Create a USER mapping and map, for example, a Date attribute (say loginDate) with a string value on the resource (say street on ldap, does not matter the meaning)
> # Define a JEXL transformer for that mapping row like this
> {code:java}
> value.toString().contains("T") ? value.toString().split("T")[0].replaceAll("-", "") : value {code}
> Or a Java/Groovy transformer with this beforePropagation:
> {code:java}
> public List<PlainAttrValue> beforePropagation(
> final Item item,
> final Entity entity,
> final List<PlainAttrValue> values) {
>
> if (values != null && !values.isEmpty()) {
> values.forEach(value -> {
> Date originalValue = value.getDateValue();
> if (originalValue != null) {
> value.setBinaryValue(null);
> value.setBooleanValue(null);
> value.setDateValue(null);
> value.setDoubleValue(null);
> value.setLongValue(null);
> value.setStringValue(makeSomeChanges(values.get(0).getDateValue()));
> }
> });
> }
> return values;
> }
> {code}
> You will notice that the value propagated is not the one changed by the transformer, sometimes (like this case) you'll get an NPE:
> {code}
> 14:40:47.203 ERROR org.apache.syncope.core.provisioning.api.MappingManager - Expression 'loginDate' processing failed
> java.lang.NullPointerException: null
> at java.util.Calendar.setTime(Calendar.java:1770) ~[?:1.8.0_191]
> at java.text.SimpleDateFormat.format(SimpleDateFormat.java:943) ~[?:1.8.0_191]
> at java.text.SimpleDateFormat.format(SimpleDateFormat.java:936) ~[?:1.8.0_191]
> at java.text.DateFormat.format(DateFormat.java:345) ~[?:1.8.0_191]
> at org.apache.syncope.core.provisioning.api.utils.FormatUtils.format(FormatUtils.java:72) ~[syncope-core-provisioning-api-2.1.3.jar:2.1.3]
> at org.apache.syncope.core.provisioning.api.utils.FormatUtils.format(FormatUtils.java:58) ~[syncope-core-provisioning-api-2.1.3.jar:2.1.3]
> at org.apache.syncope.core.provisioning.api.utils.FormatUtils.format(FormatUtils.java:54) ~[syncope-core-provisioning-api-2.1.3.jar:2.1.3]
> at org.apache.syncope.core.persistence.jpa.entity.AbstractPlainAttrValue.getValueAsString(AbstractPlainAttrValue.java:233) ~[syncope-core-persistence-jpa-2.1.3.jar:2.1.3]
> at org.apache.syncope.core.persistence.jpa.entity.AbstractPlainAttrValue.getValueAsString(AbstractPlainAttrValue.java:273) ~[syncope-core-persistence-jpa-2.1.3.jar:2.1.3]
> at org.apache.syncope.core.provisioning.java.MappingManagerImpl.prepareAttr(MappingManagerImpl.java:365) ~[syncope-core-provisioning-java-2.1.3.jar:2.1.3]
> at org.apache.syncope.core.provisioning.java.MappingManagerImpl.prepareAttrs(MappingManagerImpl.java:178) ~[syncope-core-provisioning-java-2.1.3.jar:2.1.3]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_191]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_191]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_191]
> at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_191]
> at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343) ~[spring-aop-5.1.4.RELEASE.jar:5.1.4.RELEASE]
> at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198) ~[spring-aop-5.1.4.RELEASE.jar:5.1.4.RELEASE]
> at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.1.4.RELEASE.jar:5.1.4.RELEASE]
> at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:294) ~[spring-tx-5.1.4.RELEASE.jar:5.1.4.RELEASE]
> at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98) ~[spring-tx-5.1.4.RELEASE.jar:5.1.4.RELEASE]
> at org.apache.syncope.core.persistence.jpa.spring.DomainTransactionInterceptor.invoke(DomainTransactionInterceptor.java:60) ~[syncope-core-persistence-jpa-2.1.3.jar:2.1.3]
> at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.1.4.RELEASE.jar:5.1.4.RELEASE]
> at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212) ~[spring-aop-5.1.4.RELEASE.jar:5.1.4.RELEASE]
> at com.sun.proxy.$Proxy632.prepareAttrs(Unknown Source) ~[?:?]
> at org.apache.syncope.core.provisioning.java.propagation.PropagationManagerImpl.lambda$createTasks$4(PropagationManagerImpl.java:396) ~[syncope-core-provisioning-java-2.1.3.jar:2.1.3]
> at java.util.HashMap.forEach(HashMap.java:1289) ~[?:1.8.0_191]
> at org.apache.syncope.core.provisioning.java.propagation.PropagationManagerImpl.createTasks(PropagationManagerImpl.java:368) ~[syncope-core-provisioning-java-2.1.3.jar:2.1.3]
> at org.apache.syncope.core.provisioning.java.propagation.PropagationManagerImpl.getUpdateTasks(PropagationManagerImpl.java:265) ~[syncope-core-provisioning-java-2.1.3.jar:2.1.3]
> at org.apache.syncope.core.provisioning.java.propagation.PropagationManagerImpl.getUserUpdateTasks(PropagationManagerImpl.java:197) ~[syncope-core-provisioning-java-2.1.3.jar:2.1.3]
> at org.apache.syncope.core.provisioning.java.propagation.PropagationManagerImpl.getUserUpdateTasks(PropagationManagerImpl.java:217) ~[syncope-core-provisioning-java-2.1.3.jar:2.1.3]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_191]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_191]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_191]
> at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_191]
> at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343) ~[spring-aop-5.1.4.RELEASE.jar:5.1.4.RELEASE]
> at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198) ~[spring-aop-5.1.4.RELEASE.jar:5.1.4.RELEASE]
> at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.1.4.RELEASE.jar:5.1.4.RELEASE]
> at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:294) ~[spring-tx-5.1.4.RELEASE.jar:5.1.4.RELEASE]
> at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98) ~[spring-tx-5.1.4.RELEASE.jar:5.1.4.RELEASE]
> at org.apache.syncope.core.persistence.jpa.spring.DomainTransactionInterceptor.invoke(DomainTransactionInterceptor.java:60) ~[syncope-core-persistence-jpa-2.1.3.jar:2.1.3]
> at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.1.4.RELEASE.jar:5.1.4.RELEASE]
> at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212) ~[spring-aop-5.1.4.RELEASE.jar:5.1.4.RELEASE]
> at com.sun.proxy.$Proxy697.getUserUpdateTasks(Unknown Source) ~[?:?]
> at org.apache.syncope.core.provisioning.java.DefaultUserProvisioningManager.update(DefaultUserProvisioningManager.java:118) ~[syncope-core-provisioning-java-2.1.3.jar:2.1.3]
> at org.apache.syncope.core.provisioning.java.DefaultUserProvisioningManager.update(DefaultUserProvisioningManager.java:58) ~[syncope-core-provisioning-java-2.1.3.jar:2.1.3]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_191]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_191]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_191]
> at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_191]
> at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343) ~[spring-aop-5.1.4.RELEASE.jar:5.1.4.RELEASE]
> at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:206) ~[spring-aop-5.1.4.RELEASE.jar:5.1.4.RELEASE]
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)