[jira] [Commented] (LANG-1353) NumberUtils.isNumber bug

2017-09-19 Thread yusw (JIRA)

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

yusw commented on LANG-1353:


This is a trap, if you do not see the specific implementation of the method, 
who do not know will be treated as octal. I do not think it's a good practice.

> NumberUtils.isNumber bug
> 
>
> Key: LANG-1353
> URL: https://issues.apache.org/jira/browse/LANG-1353
> Project: Commons Lang
>  Issue Type: Bug
>  Components: lang.math.*
>Affects Versions: 3.6
>Reporter: yusw
>Priority: Critical
> Fix For: 3.7
>
>
> hi,I used to NumberUtils.isNumber()[version:3.6] find this error, this error 
> is mainly caused by method isCreatable() in the 723 line of code。
> See below for details:
> String str = "0927";
> System.out.println(NumberUtils.isNumber(str));
> {color:red}//result:false{color}
> String str1 = "9027";
> System.out.println(NumberUtils.isNumber(str1));
> //result:true



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (LANG-1353) NumberUtils.isNumber bug

2017-09-19 Thread Sebb (JIRA)

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

Sebb commented on LANG-1353:


The behaviour is clearly explained in the Javadoc:

http://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/math/NumberUtils.html#isNumber-java.lang.String-

> NumberUtils.isNumber bug
> 
>
> Key: LANG-1353
> URL: https://issues.apache.org/jira/browse/LANG-1353
> Project: Commons Lang
>  Issue Type: Bug
>  Components: lang.math.*
>Affects Versions: 3.6
>Reporter: yusw
>Priority: Critical
> Fix For: 3.7
>
>
> hi,I used to NumberUtils.isNumber()[version:3.6] find this error, this error 
> is mainly caused by method isCreatable() in the 723 line of code。
> See below for details:
> String str = "0927";
> System.out.println(NumberUtils.isNumber(str));
> {color:red}//result:false{color}
> String str1 = "9027";
> System.out.println(NumberUtils.isNumber(str1));
> //result:true



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)