You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ha...@apache.org on 2009/04/28 14:46:44 UTC

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

Author: hansbak
Date: Tue Apr 28 12:46:43 2009
New Revision: 769377

URL: http://svn.apache.org/viewvc?rev=769377&view=rev
Log:
corrected non-thread safe code after a comment from David

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=769377&r1=769376&r2=769377&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 Tue Apr 28 12:46:43 2009
@@ -37,7 +37,6 @@
 
     protected String fieldName = null;
     protected String mapName = null;
-    protected Map<String, Object> map = null;
     protected String envName = null;
     protected String value = null;
     protected String format = null;
@@ -68,10 +67,11 @@
             }
             // 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
+            Map<String, Object> valueMap = null;
             if (UtilValidate.isNotEmpty(this.mapName) && context.containsKey(this.mapName)) {
-                map = (Map<String, Object>) context.get(mapName);
+                valueMap = (Map<String, Object>) context.get(mapName);
             } else {
-                map = FastMap.newInstance();
+                valueMap = FastMap.newInstance();
             }
             // process the context changes
             String newValue = null;
@@ -83,8 +83,8 @@
             
             if (newValue != null) {
                 if (UtilValidate.isNotEmpty(this.mapName)) {
-                    this.map.put(this.fieldName, newValue);
-                    context.put(this.mapName, this.map);
+                    valueMap.put(this.fieldName, newValue);
+                    context.put(this.mapName, valueMap);
                 } else {
                     context.put(this.fieldName, newValue);
                 }