svn commit: r1651597 - in /ofbiz/branches/release14.12: ./ 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: r1651597 - in /ofbiz/branches/release14.12: ./ framework/service/src/org/ofbiz/service/eca/ServiceEcaSetField.java

jacopoc
Author: jacopoc
Date: Wed Jan 14 08:45:43 2015
New Revision: 1651597

URL: http://svn.apache.org/r1651597
Log:
Applied fix from trunk for revision: 1651593
===

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/branches/release14.12/   (props changed)
    ofbiz/branches/release14.12/framework/service/src/org/ofbiz/service/eca/ServiceEcaSetField.java

Propchange: ofbiz/branches/release14.12/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jan 14 08:45:43 2015
@@ -8,4 +8,4 @@
 /ofbiz/branches/json-integration-refactoring:1634077-1635900
 /ofbiz/branches/multitenant20100310:921280-927264
 /ofbiz/branches/release13.07:1547657
-/ofbiz/trunk:1649742,1650240,1650583,1650642,1650678,1650882,1650887,1650938
+/ofbiz/trunk:1649742,1650240,1650583,1650642,1650678,1650882,1650887,1650938,1651593

Modified: ofbiz/branches/release14.12/framework/service/src/org/ofbiz/service/eca/ServiceEcaSetField.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/framework/service/src/org/ofbiz/service/eca/ServiceEcaSetField.java?rev=1651597&r1=1651596&r2=1651597&view=diff
==============================================================================
--- ofbiz/branches/release14.12/framework/service/src/org/ofbiz/service/eca/ServiceEcaSetField.java (original)
+++ ofbiz/branches/release14.12/framework/service/src/org/ofbiz/service/eca/ServiceEcaSetField.java Wed Jan 14 08:45:43 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