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

NumberUtils#createNumber - bad behaviour for leading "--"

    XMLWordPrintableJSON

Details

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

    Description

      NumberUtils#createNumber checks for a leading "--" in the string, and returns null if found. This is documented as a work round for a bug in BigDecimal.

      Returning nulll is contrary to the Javadoc and the behaviour for other methods which would throw NumberFormatException.

      It's not clear whether the BigDecimal problem still exists with recent versions of Java. However, if it does exist, then the check needs to be done for all invocations of BigDecimal, i.e. needs to be moved to createBigDecimal.

      Attachments

        1. LANG-822.patch
          2 kB
          Thomas Neidhart

        Activity

          People

            Unassigned Unassigned
            sebb Sebb
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: