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

NumberUtils#isNumber() returns false for "0.0", "0.4790", et al

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Cannot Reproduce
    • 3.3.1
    • None
    • lang.math.*
    • None
    • Java 8, Windows 7

    Description

      After upgrading from 3.1 to 3.3.1, it seems that isNumber(String str) returns false for decimal numbers with leading zeros. In other words:

      boolean ret = NumberUtils.isNumber("0.4790");
      

      On 3.1, ret was true. In 3.3.1, ret is false.

      Guessing that LANG-972 is related... comment in the code states:

      // leading 0, but not hex, must be octal
      

      This is clearly a case where leading 0 means neither hex nor octal.

      Attachments

        1. LANG-992 Refactor.patch
          9 kB
          James Sawle
        2. LANG-992-v2.patch
          1 kB
          Niall Pemberton

        Issue Links

          Activity

            People

              chtompki Rob Tompkins
              adam@labkey.com Adam Rauch
              Votes:
              2 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: