Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6449383

Rectangle contains methods don't specify what happens with 0 dimension arguments

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • 6
    • client-libs
    • Cause Known
    • x86
    • windows_xp

      A DESCRIPTION OF THE PROBLEM :
      The contains method of class rectangle doesn't not consider a zero width or height rectangle to be contained in any other.
      I found this situation in a custom paragraphview paint method. Some of the children were zero width (i think the \n) , and since i was using this method for indexing the text much head scratching ensued when sometimes the index got corrupted.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The contains (or any other method there) should specify that they don't accept zero dimension arguments. A work around is creating a method that checks that the max and min points are contained in the rectangle to check

      URL OF FAULTY DOCUMENTATION :
      http://download.java.net/jdk6/docs/api/java/awt/Rectangle.html#contains(java.awt.Rectangle)

            denis Denis Fokin (Inactive)
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: