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

Infinite loop in Rectangle2D.intersectsLine for certain parameters.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 1.3.0
    • client-libs
    • 2d
    • beta
    • x86
    • windows_98



      Name: krT82822 Date: 03/11/2000


      java version "1.3.0rc1"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0rc1-T)
      Java HotSpot(TM) Client VM (build 1.3.0rc1-S, mixed mode)

      [ eval1127@eng, 11 Mar 2000 -- also on kestrel-rc2, 1.3.0rc2-W ]

      /**
       * Simple test program that demonstrates a fatal infinite loop in
       * Rectangle2D.intersectsLine
       * The implementation of intersectsLine uses a while loop that makes an
       * incorrect assumption that arithmetic rounds nicely. However,
       * it doesn't, and there is a while loop that never exits.
       *
       * This may seem unusal - but in fact it *regulary* hangs up our drawing program
       * that lets users zoom out, and thus effectively specify points at very high
       * precision.
       *
       * @author Benjamin B. Bederson - University of Maryland
       * @date March 10, 2000
       */
      import java.awt.geom.*;

      public class testLineIntersection {
          static public void main(String args[]) {
      Rectangle2D rect = new Rectangle2D.Float(29.790712356567383f,
                                                       362.3290710449219f,
      267.40679931640625f,
                                                       267.4068298339844f);
      System.out.println("Point A");
      rect.intersectsLine(431.39777, 551.3534, 268.391, 484.71542);
      System.out.println("Point B: Never gets here!");
          }
      }
      (Review ID: 102346)
      ======================================================================

            flar Jim Graham
            kryansunw Kevin Ryan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: