commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ben Tels (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LANG-674) NumberUtils and decimal point characte
Date Sat, 03 Sep 2011 21:11:10 GMT

    [ 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

       

Mime
View raw message