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

Sebb commented on LANG-822:
---------------------------

Thanks for the patch; applied with minor changes to strengthen test case.

URL: http://svn.apache.org/viewvc?rev=1407973&view=rev
Log:
LANG-822: NumberUtils#createNumber - bad behaviour for leading "--"

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


It's still possible that the check for "--" is redundant, but at least now the 
code is consistent in applying the check and reporting the exception.
                
> NumberUtils#createNumber - bad behaviour for leading "--"
> ---------------------------------------------------------
>
>                 Key: LANG-822
>                 URL: https://issues.apache.org/jira/browse/LANG-822
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.math.*
>    Affects Versions: 3.1
>            Reporter: Sebb
>             Fix For: 3.2
>
>         Attachments: LANG-822.patch
>
>
> NumberUtils#createNumber checks for a leading "--" in the string, and returns 
> null if found. This is documented as a work round for a bug in BigDecimal.
> Returning nulll is contrary to the Javadoc and the behaviour for other 
> methods which would throw NumberFormatException.
> It's not clear whether the BigDecimal problem still exists with recent 
> versions of Java. However, if it does exist, then the check needs to be done 
> for all invocations of BigDecimal, i.e. needs to be moved to createBigDecimal.

--
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

Reply via email to