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

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.0
    • Component/s: lang.math.*
    • Labels:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: