You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Henri Yandell (JIRA)" <ji...@apache.org> on 2011/01/01 07:52:45 UTC

[jira] Updated: (LANG-664) NumberUtils.isNumber(String) is not right when the String is "1.1L"

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