commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (LANG-693) Method createNumber from NumberUtils doesn't work for floating point numbers other than Float
Date Sun, 19 May 2013 10:37:17 GMT

     [ https://issues.apache.org/jira/browse/LANG-693?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Sebb resolved LANG-693.
-----------------------

       Resolution: Fixed
    Fix Version/s:     (was: 3.x)
                   3.2

Thanks very much; neat fix. Applied here:

URL: http://svn.apache.org/r1484263
Log:
LANG-693 Method createNumber from NumberUtils doesn't work for floating point numbers other
than Float

Modified:
    commons/proper/lang/trunk/src/changes/changes.xml
    commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java

=====

I made two very trivial style changes: moved the declaration of numDecimals closer to where
it is first used, and changed less => fewer in a comment (grammatical pedantry on my part!).

Thanks again.
                
> Method createNumber from NumberUtils doesn't work for floating point numbers other than
Float
> ---------------------------------------------------------------------------------------------
>
>                 Key: LANG-693
>                 URL: https://issues.apache.org/jira/browse/LANG-693
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.math.*
>    Affects Versions: 2.6
>            Reporter: Carlos Rego
>            Priority: Minor
>             Fix For: 3.2
>
>         Attachments: LANG-693(2).patch
>
>
> Method createNumber from NumberUtils is trying to parse a string with a floating point
number always first as a Float, that will cause that if we send a string with a number that
will need a Double or even a BigDecimal the number will be truncate to accommodate into the
Float without an exception to be thrown, so in fact we will no be returning ever neither a
Double nor a BigDecimal.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message