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

Internal Exception in Area.subtract method.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • 6
    • 5.0
    • client-libs
    • 2d
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      java version "1.5.0_05"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_05-b05)
      Java HotSpot(TM) Client VM (build 1.5.0_05-b05, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows 2000 [Version 5.00.2195]

      A DESCRIPTION OF THE PROBLEM :
      The Area.subtract method throws an internal exception for some valid input.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      The following steps will result in an exception being thrown for certain input values.

      Create an Arc2D.
      Create an Area from the Arc2D.
      Create an Ellipse2D.
      Create a second area from the Ellipse2D.
      Subtract the second area from the first area.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The subtract method should result in a valid shape.
      ACTUAL -
      The subtract method threw an exception.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Exception in thread "main" java.lang.InternalError: bad y (7.52316384526264E-51, 7.527506696442659E-51=>4.249999999999999)
              at sun.awt.geom.Order3.TforY(Order3.java:340)
              at sun.awt.geom.Order3.XforY(Order3.java:499)
              at sun.awt.geom.Curve.compareTo(Curve.java:518)
              at sun.awt.geom.Edge.compareTo(Edge.java:72)
              at sun.awt.geom.AreaOp.pruneEdges(AreaOp.java:260)
              at sun.awt.geom.AreaOp.calculate(AreaOp.java:141)
              at java.awt.geom.Area.subtract(Area.java:140)
              at com.materials_sciences.FrontEnd.GraphicsCrash.<init>(GraphicsCrash.java:43)
              at com.materials_sciences.FrontEnd.GraphicsCrash.main(GraphicsCrash.java:47)


      REPRODUCIBILITY :
      This bug can be reproduced often.

      ---------- BEGIN SOURCE ----------
      import java.awt.geom.Arc2D;
      import java.awt.geom.Area;
      import java.awt.geom.Ellipse2D;

      public class GraphicsCrash {
          
          /** Creates a new instance of GraphicsCrash */
          public GraphicsCrash() {
              double x = -4.250000000000002;
              double y = 0.0;
              double width = 8.5;
              double height = 8.5;
              double start = -450.0;
              double extent = 180.0;
              
              Arc2D outerArc = new Arc2D.Double(x, y, width, height, start, extent, Arc2D.PIE);
              
              Area tmp = new Area(outerArc);
              
              x = -4.000000000000002;
              y = 0.25;
              width = 8.0;
              height = 8.0;
              
              Ellipse2D innerArc = new Ellipse2D.Double(x, y, width, height);
              
              tmp.subtract(new Area(innerArc));
          }
          
          public static void main(String[] args) {
              GraphicsCrash gc = new GraphicsCrash();
          }
      }

      ---------- END SOURCE ----------

            flar Jim Graham
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: