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

NumberUtils.isNumber(String) is not right when the String is "1.1L"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 3.0
    • lang.math.*
    • None

    Description

      "1.1L" is not a Java Number . but NumberUtils.isNumber(String) return true.

      perhaps change:

                  if (chars[i] == 'l'
                      || chars[i] == 'L') {
                      // not allowing L with an exponent
                      return foundDigit && !hasExp;
                  }
      

      to:

                  if (chars[i] == 'l'
                      || chars[i] == 'L') {
                      // not allowing L with an exponent
                      return foundDigit && !hasExp && !hasDecPoint;
                  }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            cctvfly leiqin
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: