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

NumberUtils#isNumber(String) fails to reject invalid Octal numbers

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.2.1
    • Fix Version/s: 3.3
    • Component/s: lang.math.*
    • Labels:
      None

      Description

      When trying to convert "0085" with NumberUtils.createInteger(String) an NumberFormatException is thrown.

      This is because the leading 0 causes the String to be evaluated as an Octal, 8 is not a valid octal.

      However NumberUtils#isNumber(String) evaluates to true, even so it cannot be converted.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                sknitelius Stephan Knitelius
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: