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

Rob Tompkins resolved LANG-1038.
--------------------------------
       Resolution: Fixed
    Fix Version/s:     (was: Discussion)
                   3.5

https://github.com/apache/commons-lang/pull/186 fixes this.

> NumberUtils#isNumber() returns false for "+2" and true for "-2"
> ---------------------------------------------------------------
>
>                 Key: LANG-1038
>                 URL: https://issues.apache.org/jira/browse/LANG-1038
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.math.*
>    Affects Versions: 3.1, 3.3.2
>            Reporter: will mason
>            Assignee: Rob Tompkins
>             Fix For: 3.5
>
>
> The strings {{"\+2"}} and {{"\+  2"}} give a "False" result when tested by 
> {{isNumber()}}.
> Case one, {{"\+2"}} is legal with {{Integer.parseInt()}}.  Case two: {{"\+  
> 2"}} gives an exception with {{Integer.parseInt()}}.
> I believe the function should match legitimate inputs for the respective 
> parser function depending on the number type.
> Workaround: Use something like:
> {code:java}
> NumberUtils.isNumber( wrkStr.replaceFirst( "\\+", "") )
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to