You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Max Starets (JIRA)" <de...@myfaces.apache.org> on 2009/04/15 22:39:15 UTC
[jira] Created: (TRINIDAD-1455) NumberConverter caches only the
first encountered converter for a given type. Converters for other locales
are recreated every time
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.
[jira] Updated: (TRINIDAD-1455) NumberConverter caches only the
first encountered converter for a given type. Converters for other locales
are recreated every time
Posted by "Matthias Weßendorf (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/TRINIDAD-1455?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Matthias Weßendorf updated TRINIDAD-1455:
-----------------------------------------
Resolution: Fixed
Fix Version/s: 1.2.12-core
Assignee: Matthias Weßendorf
Status: Resolved (was: Patch Available)
> 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
> Assignee: Matthias Weßendorf
> Fix For: 1.2.12-core
>
> 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.
[jira] Updated: (TRINIDAD-1455) NumberConverter caches only the
first encountered converter for a given type. Converters for other locales
are recreated every time
Posted by "Max Starets (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/TRINIDAD-1455?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Max Starets updated TRINIDAD-1455:
----------------------------------
Status: Patch Available (was: Open)
> 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.