[ 
https://issues.apache.org/jira/browse/LANG-693?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13025634#comment-13025634
 ] 

Carlos Rego commented on LANG-693:
----------------------------------

In an automatic conversion to string of a number you will not have the 
qualifier, so if you try to undo the conversion with this method it will fail, 
because the approach when you don't sent the qualifier is not working. Anyway, 
we are working with BigDecimal instances that don't have a qualifier.

If you don't want a whole refactor of the method you could at least check if 
the resulted number has the same toString value than the parameter and if not 
try with a larger type, that should avoid this kind of problem (not very nice 
approach anyway).

> 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
>
> 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.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to