You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Jeremy Lemaire (JIRA)" <ji...@apache.org> on 2006/12/19 18:48:23 UTC

[jira] Created: (LANG-300) NumberUtils.createNumber throws NumberFormatException for one digit long

NumberUtils.createNumber throws NumberFormatException for one digit long 
-------------------------------------------------------------------------

                 Key: LANG-300
                 URL: http://issues.apache.org/jira/browse/LANG-300
             Project: Commons Lang
          Issue Type: Bug
    Affects Versions: 2.2
            Reporter: Jeremy Lemaire


NumberUtils.createNumber throws a NumberFormatException when parsing "1l", "2l" .. etc...

It works fine if you try to parse "01l" or "02l".  The condition isDigits(numeric.substring(1)), line 455 return false as numeric.substring(1) is an empty string for "1l"

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Closed: (LANG-300) NumberUtils.createNumber throws NumberFormatException for one digit long

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/LANG-300?page=all ]

Henri Yandell closed LANG-300.
------------------------------

    Fix Version/s: 2.3
       Resolution: Fixed

svn ci -m "Fixing LANG-300 (reported by Jeremy Lemaire) - 1L to 9L incorrectly throw exceptions when passed into NumberUtils.createNumber. Fixed in both the math.NumbersUtils and the deprecated NumberUtils classes. "

Sending        src/java/org/apache/commons/lang/NumberUtils.java
Sending        src/java/org/apache/commons/lang/math/NumberUtils.java
Sending        src/test/org/apache/commons/lang/math/NumberUtilsTest.java
Transmitting file data ...
Committed revision 488819.

> NumberUtils.createNumber throws NumberFormatException for one digit long
> ------------------------------------------------------------------------
>
>                 Key: LANG-300
>                 URL: http://issues.apache.org/jira/browse/LANG-300
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.2
>            Reporter: Jeremy Lemaire
>             Fix For: 2.3
>
>         Attachments: LANG-300.patch
>
>
> NumberUtils.createNumber throws a NumberFormatException when parsing "1l", "2l" .. etc...
> It works fine if you try to parse "01l" or "02l".  The condition isDigits(numeric.substring(1)), line 455 return false as numeric.substring(1) is an empty string for "1l"

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Updated: (LANG-300) NumberUtils.createNumber throws NumberFormatException for one digit long

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/LANG-300?page=all ]

Henri Yandell updated LANG-300:
-------------------------------

    Attachment: LANG-300.patch

Merging the third and fourth parts of that if statement together seems to solve the problem.

Unit test and patch attached.

> NumberUtils.createNumber throws NumberFormatException for one digit long
> ------------------------------------------------------------------------
>
>                 Key: LANG-300
>                 URL: http://issues.apache.org/jira/browse/LANG-300
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.2
>            Reporter: Jeremy Lemaire
>         Attachments: LANG-300.patch
>
>
> NumberUtils.createNumber throws a NumberFormatException when parsing "1l", "2l" .. etc...
> It works fine if you try to parse "01l" or "02l".  The condition isDigits(numeric.substring(1)), line 455 return false as numeric.substring(1) is an empty string for "1l"

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org