Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-1385

NumberUtils.createNumber() throws StringIndexOutOfBoundsException instead of NumberFormatException

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.7
    • 3.8
    • lang.math.*
    • None

    Description

      Test case:

      NumberUtils.createNumber("L")

      Expected: NumberFormatException

      Got:

      java.lang.StringIndexOutOfBoundsException: String index out of range: 0
      at java.lang.String.charAt(String.java:658)
       at org.apache.commons.lang3.math.NumberUtils.createNumber(NumberUtils.java:528)
      

       

       

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            ggregory Gary D. Gregory
            rohanpadhye Rohan Padhye
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment