You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2019/01/17 14:13:48 UTC

[syncope] branch 2_0_X updated: [SYNCOPE-1425] Erasing all values but string, which is replaced with transformation result

This is an automated email from the ASF dual-hosted git repository.

ilgrosso pushed a commit to branch 2_0_X
in repository https://gitbox.apache.org/repos/asf/syncope.git


The following commit(s) were added to refs/heads/2_0_X by this push:
     new ab47743  [SYNCOPE-1425] Erasing all values but string, which is replaced with transformation result
ab47743 is described below

commit ab47743c569d3bdf3c67e37f66a410cb3e7f1b42
Author: Francesco Chicchiriccò <il...@apache.org>
AuthorDate: Thu Jan 17 15:09:40 2019 +0100

    [SYNCOPE-1425] Erasing all values but string, which is replaced with transformation result
---
 .../java/data/JEXLItemTransformerImpl.java         | 26 ++++++++++++++--------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/JEXLItemTransformerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/JEXLItemTransformerImpl.java
index 98042c5..1c67951 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/JEXLItemTransformerImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/JEXLItemTransformerImpl.java
@@ -57,17 +57,25 @@ public class JEXLItemTransformerImpl extends DefaultItemTransformer implements J
 
         if (StringUtils.isNotBlank(propagationJEXL) && values != null) {
             for (PlainAttrValue value : values) {
-                JexlContext jexlContext = new MapContext();
-                if (entity != null) {
-                    JexlUtils.addFieldsToContext(entity, jexlContext);
-                    if (entity instanceof Any) {
-                        JexlUtils.addPlainAttrsToContext(((Any<?>) entity).getPlainAttrs(), jexlContext);
-                        JexlUtils.addDerAttrsToContext(((Any<?>) entity), jexlContext);
+                Object originalValue = value.getValue();
+                if (originalValue != null) {
+                    JexlContext jexlContext = new MapContext();
+                    if (entity != null) {
+                        JexlUtils.addFieldsToContext(entity, jexlContext);
+                        if (entity instanceof Any) {
+                            JexlUtils.addPlainAttrsToContext(((Any<?>) entity).getPlainAttrs(), jexlContext);
+                            JexlUtils.addDerAttrsToContext(((Any<?>) entity), jexlContext);
+                        }
                     }
+                    jexlContext.set("value", originalValue.toString());
+
+                    value.setBinaryValue(null);
+                    value.setBooleanValue(null);
+                    value.setDateValue(null);
+                    value.setDoubleValue(null);
+                    value.setLongValue(null);
+                    value.setStringValue(JexlUtils.evaluate(propagationJEXL, jexlContext));
                 }
-                jexlContext.set("value", value.getValueAsString());
-
-                value.setStringValue(JexlUtils.evaluate(propagationJEXL, jexlContext));
             }
 
             return values;