NumberConverter caches only the first encountered converter for a given type.
Converters for other locales are recreated every time
-----------------------------------------------------------------------------------------------------------------------------------
Key: TRINIDAD-1455
URL: https://issues.apache.org/jira/browse/TRINIDAD-1455
Project: MyFaces Trinidad
Issue Type: Bug
Affects Versions: 1.2.11-core
Reporter: Max Starets
Attachments: converter.patch
_cacheNumberFormat() has the following code that is wrong:
// The key could have either been the type based on which formats are
// stored or it can be based on the pattern also.
String key = ((pattern != null) ? pattern : type);
Map<Locale, NumberFormat> nfMap = _numberFormatHolder.get(key);
// if we have not cached any NumberFormat for this type, then create a
// map for that type and add to it based on the locale
if (nfMap == null)
{
nfMap = new HashMap<Locale, NumberFormat>();
nfMap.put(locale, (NumberFormat)format.clone());
}
// add this based on the type ('number','currency','percent') or
// pattern1, pattern2.. patternN to the main holder
_numberFormatHolder.put(key, nfMap);
Note that the placement for the two put() calls should be swapped. New map
entry for a Locale should be added every time, while nfMap for
a given key should be added to _numberFormatHolder only when nfMap gets created.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.