[ 
http://www.stripesframework.org/jira/browse/STS-757?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ben Gunter closed STS-757.
--------------------------


> NumberTypeConverterSupport fails with some unusual Locales 
> -----------------------------------------------------------
>
>                 Key: STS-757
>                 URL: http://www.stripesframework.org/jira/browse/STS-757
>             Project: Stripes
>          Issue Type: Bug
>          Components: Validation
>    Affects Versions: Release 1.5.3
>            Reporter: Michael Krkoska
>            Assignee: Frederic Daoud
>            Priority: Minor
>             Fix For: Release 1.6
>
>
> NumberTypeConverterSupport.setLocale(Locale) includes this code:
>         if (locale.getCountry() != null && !"".equals(locale.getCountry()))
>             this.currencySymbol = 
> Currency.getInstance(locale).getSymbol(locale);
> Unfortunately for Locales where there is no Currency for the Locale's 
> country, this fails:
> java.lang.IllegalArgumentException
>       at java.util.Currency.getInstance(Currency.java:260)
> Obviously a way to prevent this, is not to use such Locales. But let's see 
> what java.text.DecimalFormatSymbols does in its initialize(Locale):
>     
>         if (!"".equals(locale.getCountry())) {
>             try {
>                 currency = Currency.getInstance(locale);
>             } catch (IllegalArgumentException e) {
>                 // use default values below for compatibility
>             }
>         }
> I propose to patch NumberTypeConverterSupport to fix this behaviour.
> Instead of         
>         if (locale.getCountry() != null && !"".equals(locale.getCountry()))
>             this.currencySymbol = 
> Currency.getInstance(locale).getSymbol(locale);
>         else
>             this.currencySymbol = "$";
>             
> I'd like
>         this.currencySymbol = "$";
>         if (locale.getCountry() != null && !"".equals(locale.getCountry())){
>             try {
>                 this.currencySymbol = 
> Currency.getInstance(locale).getSymbol(locale);
>             } catch (IllegalArgumentException e) {
>                 // use dollar as default value
>             }
>         }

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to