It's just a temporary hack I hastily commited last night, so as I was unsure I 
preferred to be safe than sorry.
Good to know that MethodContext is thread safe.

I have still to check but your new data model proposition sounds to me at 1st 
glance.

Note that the current works well, even for i18n, as long as you only use a 
direct relation with data.
But if you use <set> to save your data in DB then the problem arises.. That's 
why I got this way...

Jacques

On Thursday, January 02, 2014 1:39 AM adrian.c...@sandglass-software.com wrote
> There is no need to synchronize on the <set> element model - it is
> thread-safe. The MethodContext instance is per-thread, so it doesn't
> need synchronization either.
> 
> Please take some time to understand the architecture before committing
> changes like this.
> 
> Adrian Crum
> Sandglass Software
> www.sandglass-software.com
> 
> On 1/1/2014 7:15 PM, jler...@apache.org wrote:
>> Author: jleroux
>> Date: Thu Jan  2 00:15:38 2014
>> New Revision: 1554706
>> 
>> URL: http://svn.apache.org/r1554706
>> Log:
>> This is a temporary hack waiting for a better geolocation data model, 
>> related with OFBIZ-5453
>> 
>> Modified:
>>      
>> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetOperation.java
>> 
>> Modified: 
>> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetOperation.java
>> URL:
>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetOperation.java?rev=1554706&r1=1554705&r2=1554706&view=diff
>> ==============================================================================
>>  ---
>> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetOperation.java
>>  (original) +++
>> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetOperation.java
>>  Thu Jan  2 00:15:38 2014 @@ -144,10
>>                   +144,17 @@ public final class SetOperation extends 
>> Debug.logWarning(exc, "Error evaluating scriptlet [" +
>>               this.scriptlet + "]: " + exc, module); }
>>           } else if (!this.fromFma.isEmpty()) {
>> +            Locale localeTemp = null; // FIXME this is a temporary hack 
>> waiting for a better geolocation data model, related
>>               with OFBIZ-5453 if (!this.localeFse.isEmpty() && 
>> this.type.length() > 0) {
>> -                methodContext.setLocale(new 
>> Locale(this.localeFse.expandString(methodContext.getEnvMap())));
>> +                localeTemp = methodContext.getLocale();
>> +                synchronized (this) {
>> +                    methodContext.setLocale(new 
>> Locale(this.localeFse.expandString(methodContext.getEnvMap())));
>> +                    newValue = this.fromFma.get(methodContext.getEnvMap());
>> +                    methodContext.setLocale(localeTemp);
>> +                }
>> +            } else {
>> +                newValue = this.fromFma.get(methodContext.getEnvMap());
>>               }
>> -            newValue = this.fromFma.get(methodContext.getEnvMap());
>>               if (Debug.verboseOn())
>>                   Debug.logVerbose("In screen getting value for field from 
>> [" + this.fromFma.toString() + "]: " + newValue,
>>           module); } else if (!this.valueFse.isEmpty()) {

Reply via email to