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

NumberRange inaccurate for Long, etc.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0
    • 2.0
    • None
    • None
    • Operating System: All
      Platform: All

    • 14884

    Description

      NumberRange assumes everything is representable by a double. This is not the
      case. In particular the classes Long, BigInteger and BigDecimal are standard
      parts of J2SE that do not obey to assumption. As an example the following test
      fails.

      assertFalse(new NumberRange(new Long(Long.MAX_VALUE)).includesNumber(new
      Long(Long.MAX_VALUE-1)));

      I guess this bug is really a problem with the design of the class. You could
      check the exact class and take appropriate action, but that would be long,
      complicated and quite possibly pointless. I would suggest that the class is
      replaced with one that assumes doubles instead of Number.

      Attachments

        Activity

          People

            Unassigned Unassigned
            tackline@tackline.demon.co.uk Thomas Hawtin
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: