You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Henri Yandell (JIRA)" <ji...@apache.org> on 2011/01/30 04:44:43 UTC
[jira] Created: (LANG-674) NumberUtils and decimal point characte
NumberUtils and decimal point characte
--------------------------------------
Key: LANG-674
URL: https://issues.apache.org/jira/browse/LANG-674
Project: Commons Lang
Issue Type: Bug
Components: lang.math.*
Reporter: Henri Yandell
Fix For: 3.1
Stevo Slavić reports on commons-user:
Is there any valid reason why '.' is hardcoded as decimal point
character in lang.math.NumberUtils, commons-lang (2.6) ? Shouldn't
this be locale dependent?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (LANG-674) NumberUtils and decimal point characte
Posted by "Stevo Slavic (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LANG-674?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12988629#action_12988629 ]
Stevo Slavic commented on LANG-674:
-----------------------------------
With plain Java I can parse String number representations with either dot or comma as decimal point character depending on locale, but not with commons-lang 2.6 lang.math API. See java.text.NumberFormat, java.text.DecimalFormatSymbols.decimalSeparator.
E.g.
NumberFormat.getNumberInstance(Locale.US).parse(sPrice)
will properly handle price string with dot as decimal point character for US locale while
NumberFormat.getNumberInstance(new Locale("nl")).parse(sPrice);
will properly handle price string with command as decimal point character for Dutch locale.
> NumberUtils and decimal point characte
> --------------------------------------
>
> Key: LANG-674
> URL: https://issues.apache.org/jira/browse/LANG-674
> Project: Commons Lang
> Issue Type: Bug
> Components: lang.math.*
> Reporter: Henri Yandell
> Fix For: 3.1
>
>
> Stevo Slavić reports on commons-user:
> Is there any valid reason why '.' is hardcoded as decimal point
> character in lang.math.NumberUtils, commons-lang (2.6) ? Shouldn't
> this be locale dependent?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] [Commented] (LANG-674) NumberUtils and decimal point
characte
Posted by "Ben Tels (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LANG-674?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13096760#comment-13096760 ]
Ben Tels commented on LANG-674:
-------------------------------
I have to say I agree with Stevo that something is rotten in the state of Denmark with this one. True, what exactly is wrong depends on your point of view, but it is definitely something.
If, as Stephen says, the semantics of NumberUtils should match those of Java sourcecode, then the simple problem is that the documentation on the methods in NumberUtils doesn't SAY that. Or otherwise doesn't say that you're supposed to use input formatted according to the en_US locale.
>From a different point of view, the (larger) problem may indeed be that the NumberUtils methods do not take locale into account. In the nl locale, as Stevo says, the value "123,4" is a valid number equivalent to 1234/10.
Perhaps a good solution is to do both: overload all the methods that take String arguments to take a Locale argument as well, then put in the documentation that the existing methods implicitly use locale en_US.
> NumberUtils and decimal point characte
> --------------------------------------
>
> Key: LANG-674
> URL: https://issues.apache.org/jira/browse/LANG-674
> Project: Commons Lang
> Issue Type: Bug
> Components: lang.math.*
> Reporter: Henri Yandell
> Fix For: 3.x
>
>
> Stevo Slavić reports on commons-user:
> Is there any valid reason why '.' is hardcoded as decimal point
> character in lang.math.NumberUtils, commons-lang (2.6) ? Shouldn't
> this be locale dependent?
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (LANG-674) NumberUtils and decimal point characte
Posted by "Stephen Colebourne (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LANG-674?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12988557#action_12988557 ]
Stephen Colebourne commented on LANG-674:
-----------------------------------------
NumberUtils should match Java source code, which requires a dot.
> NumberUtils and decimal point characte
> --------------------------------------
>
> Key: LANG-674
> URL: https://issues.apache.org/jira/browse/LANG-674
> Project: Commons Lang
> Issue Type: Bug
> Components: lang.math.*
> Reporter: Henri Yandell
> Fix For: 3.1
>
>
> Stevo Slavić reports on commons-user:
> Is there any valid reason why '.' is hardcoded as decimal point
> character in lang.math.NumberUtils, commons-lang (2.6) ? Shouldn't
> this be locale dependent?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.