svn commit: r1651593 - /ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaSetField.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1651593 - /ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaSetField.java

jacopoc
Author: jacopoc
Date: Wed Jan 14 08:40:08 2015
New Revision: 1651593

URL: http://svn.apache.org/r1651593
Log:
Since ServiceEcaSetField are cached, if a seca definition contains a set operation with an env-name like:
 <set field-name="partyId" env-name="${userLogin.partyId}"/>
then the expanded value (at the time of creation) is stored in the ServiceEcaSetField and then reused even when the seca is re-executed with a different context.
This commit fix the bug by removing the outer if statement "if (UtilValidate.isEmpty(this.value))".
Thanks to Deepak Dixit for spotting this issue.

Modified:
    ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaSetField.java

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaSetField.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaSetField.java?rev=1651593&r1=1651592&r2=1651593&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaSetField.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaSetField.java Wed Jan 14 08:40:08 2015
@@ -56,15 +56,13 @@ public class ServiceEcaSetField {
     public void eval(Map<String, Object> context) {
         if (fieldName != null) {
             // try to expand the envName
-            if (UtilValidate.isEmpty(this.value)) {
-                if (UtilValidate.isNotEmpty(this.envName) && this.envName.startsWith("${")) {
-                    FlexibleStringExpander exp = FlexibleStringExpander.getInstance(this.envName);
-                    String s = exp.expandString(context);
-                    if (UtilValidate.isNotEmpty(s)) {
-                        value = s;
-                    }
-                    Debug.logInfo("Expanded String: " + s, module);
+            if (UtilValidate.isNotEmpty(this.envName) && this.envName.startsWith("${")) {
+                FlexibleStringExpander exp = FlexibleStringExpander.getInstance(this.envName);
+                String s = exp.expandString(context);
+                if (UtilValidate.isNotEmpty(s)) {
+                    value = s;
                 }
+                Debug.logInfo("Expanded String: " + s, module);
             }
             // TODO: rewrite using the ContextAccessor.java see hack below to be able to use maps for email notifications
             // check if target is a map and create/get from contaxt