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

NumberUtils.createNumber() behaves inconsistently with NumberUtils.isNumber()

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.1
    • Fix Version/s: 3.5
    • Component/s: lang.math.*
    • Labels:
      None

      Description

      The NumberUtils.createNumber() method fails to check for multiple trailing characters, and as a result, it returns a value even though NumberUtils.isNumber() indicates that it should not. For example:

      boolean isNumber = NumberUtils.isNumber("81.5514DD");   // returns false
      
      Number numValue = NumberUtils.createNumber("81.5514DD");  // returns a Double value, 81.5514
      

      I would expect the createNumber() method to throw a NumberFormatException in this case.

        Attachments

          Activity

            People

            • Assignee:
              chonton Charles Honton
              Reporter:
              dbrown_bps Daniel Brown
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: