Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3E21BDCE1 for ; Sun, 1 Jul 2012 23:33:48 +0000 (UTC) Received: (qmail 48795 invoked by uid 500); 1 Jul 2012 23:33:47 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 48719 invoked by uid 500); 1 Jul 2012 23:33:47 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 48701 invoked by uid 99); 1 Jul 2012 23:33:47 -0000 Received: from issues-vm.apache.org (HELO issues-vm) (140.211.11.160) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 01 Jul 2012 23:33:47 +0000 Received: from isssues-vm.apache.org (localhost [127.0.0.1]) by issues-vm (Postfix) with ESMTP id 9D7C0142822 for ; Sun, 1 Jul 2012 23:33:45 +0000 (UTC) Date: Sun, 1 Jul 2012 23:33:45 +0000 (UTC) From: "Sebb (JIRA)" To: issues@commons.apache.org Message-ID: <42021394.77048.1341185625647.JavaMail.jiratomcat@issues-vm> In-Reply-To: <896001746.71059.1340964823648.JavaMail.jiratomcat@issues-vm> Subject: [jira] [Commented] (CLI-226) createNumber() in TypeHandler cannot work with some Locale MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CLI-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13404863#comment-13404863 ] Sebb commented on CLI-226: -------------------------- The proposed Javadoc change is not strictly true, as ',' only works as described if it is the decimal separator. The Javadoc should describe what actually happens. Also, according to its Javadoc, the NumberFormat#parse() method does not necessarily use the full string, so this might allow trailing garbage. > 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 > Labels: i18n > Attachments: cli-226.diff > > > 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