commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <GGreg...@rocketsoftware.com>
Subject Re: [jira] [Created] (CLI-226) createNumber() in TypeHandler cannot work with some Locale
Date Fri, 29 Jun 2012 11:37:14 GMT
Feel free to provide a patch! 

Gary

On Jun 29, 2012, at 6:12, "Olivier Sechet (JIRA)" <jira@apache.org> wrote:

> Olivier Sechet created CLI-226:
> ----------------------------------
> 
>             Summary: createNumber() in TypeHandler cannot work with some Locale
>                 Key: CLI-226
>                 URL: https://issues.apache.org/jira/browse/CLI-226
>             Project: Commons CLI
>          Issue Type: Bug
>    Affects Versions: 1.2
>            Reporter: Olivier Sechet
> 
> 
> The {{createNumber()}} method in the {{TypeHandler}} class expects the decimal separator
to be a dot ({{'.'}}). However the dot is not used in all the languages as a decimal separator.
Most of the European countries, Russia and a lot of others countries uses a comma ({{','}}).
> 
> With the corresponding {{Locale}}, the {{createNumber()}} method fails, throwing an exception.
> 
> For example:
> {code:title=Type.java|borderStyle=solid}
> public class Type {
> 
>    public static void main(final String[] args) {
>        java.util.Locale.setDefault(java.util.Locale.GERMANY);
>        String text = java.text.NumberFormat.getNumberInstance().format(12.34);
>        Number nb = org.apache.commons.cli.TypeHandler.createNumber(text);
>        System.out.println(nb);
>    }
> }
> {code}
> 
> 
> --
> This message is automatically generated by JIRA.
> If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
> For more information on JIRA, see: http://www.atlassian.com/software/jira
> 
> 

Mime
View raw message