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

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

    XMLWordPrintableJSON

    Details

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

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

              Dates

              • Created:
                Updated:
                Resolved: