You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "雷钦 (JIRA)" <ji...@apache.org> on 2010/12/07 06:31:09 UTC
[jira] Created: (LANG-664) NumberUtils.isNumber(String) is not
right when the String is "1.1L"
NumberUtils.isNumber(String) is not right when the String is "1.1L"
--------------------------------------------------------------------
Key: LANG-664
URL: https://issues.apache.org/jira/browse/LANG-664
Project: Commons Lang
Issue Type: Bug
Components: lang.math.*
Reporter: 雷钦
"1.1L" is not a Java Number . but NumberUtils.isNumber(String) return true.
perhaps :
change:
if (chars[i] == 'l'
|| chars[i] == 'L') {
// not allowing L with an exponent
return foundDigit && !hasExp;
}
to:
if (chars[i] == 'l'
|| chars[i] == 'L') {
// not allowing L with an exponent
return foundDigit && !hasExp && !hasDecPoint;
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (LANG-664) NumberUtils.isNumber(String) is not
right when the String is "1.1L"
Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LANG-664?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Henri Yandell closed LANG-664.
------------------------------
Resolution: Fixed
Fix Version/s: 3.0
Thanks - that's exactly the fix I applied :)
svn ci -m "Fixing NumberUtils.isNumber so that 1.1L is not considered a number. LANG-664"
Sending src/main/java/org/apache/commons/lang3/math/NumberUtils.java
Sending src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java
Transmitting file data ..
Committed revision 1054202.
> NumberUtils.isNumber(String) is not right when the String is "1.1L"
> --------------------------------------------------------------------
>
> Key: LANG-664
> URL: https://issues.apache.org/jira/browse/LANG-664
> Project: Commons Lang
> Issue Type: Bug
> Components: lang.math.*
> Reporter: 雷钦
> Fix For: 3.0
>
>
> "1.1L" is not a Java Number . but NumberUtils.isNumber(String) return true.
> perhaps change:
> {code:java}
> if (chars[i] == 'l'
> || chars[i] == 'L') {
> // not allowing L with an exponent
> return foundDigit && !hasExp;
> }
> {code}
> to:
> {code:java}
> if (chars[i] == 'l'
> || chars[i] == 'L') {
> // not allowing L with an exponent
> return foundDigit && !hasExp && !hasDecPoint;
> }
> {code}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (LANG-664) NumberUtils.isNumber(String) is not
right when the String is "1.1L"
Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LANG-664?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Henri Yandell updated LANG-664:
-------------------------------
Description:
"1.1L" is not a Java Number . but NumberUtils.isNumber(String) return true.
perhaps change:
{code:java}
if (chars[i] == 'l'
|| chars[i] == 'L') {
// not allowing L with an exponent
return foundDigit && !hasExp;
}
{code}
to:
{code:java}
if (chars[i] == 'l'
|| chars[i] == 'L') {
// not allowing L with an exponent
return foundDigit && !hasExp && !hasDecPoint;
}
{code}
was:
"1.1L" is not a Java Number . but NumberUtils.isNumber(String) return true.
perhaps :
change:
if (chars[i] == 'l'
|| chars[i] == 'L') {
// not allowing L with an exponent
return foundDigit && !hasExp;
}
to:
if (chars[i] == 'l'
|| chars[i] == 'L') {
// not allowing L with an exponent
return foundDigit && !hasExp && !hasDecPoint;
}
> NumberUtils.isNumber(String) is not right when the String is "1.1L"
> --------------------------------------------------------------------
>
> Key: LANG-664
> URL: https://issues.apache.org/jira/browse/LANG-664
> Project: Commons Lang
> Issue Type: Bug
> Components: lang.math.*
> Reporter: 雷钦
>
> "1.1L" is not a Java Number . but NumberUtils.isNumber(String) return true.
> perhaps change:
> {code:java}
> if (chars[i] == 'l'
> || chars[i] == 'L') {
> // not allowing L with an exponent
> return foundDigit && !hasExp;
> }
> {code}
> to:
> {code:java}
> if (chars[i] == 'l'
> || chars[i] == 'L') {
> // not allowing L with an exponent
> return foundDigit && !hasExp && !hasDecPoint;
> }
> {code}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.