JDK-6385010 : REGRESSION: java.lang.InternalError: backstepping from (Transforming Area)
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 6
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2006-02-13
  • Updated: 2011-01-19
  • Resolved: 2006-03-22
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6 b77Fixed
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.6.0-rc"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-rc-b70)
Java HotSpot(TM) Client VM (build 1.6.0-rc-b70, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Windows XP Professional
Version 2002
Service Pack 2

A DESCRIPTION OF THE PROBLEM :
The attached code (Areatest.java) creates an Area and then rotates it. The code works on jdk1.5.0_01 but fails on jdk1.6.0_rc.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run the AreaTest  with jdk's in question

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The AreaTest runs OK with jdk1.5.0 and fails with jdk1.6.0_rc.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
C:\java\jdk1.6.0\bin>java AreaTest
this == Curve[1, (-1470.6331787109348, -13679.261718749998), (1470.6331787109348, 13679.261718749998), D]
that == Curve[2, (-1470.6331787109252, -13679.261718749998), (-1470.63317871093, -13679.261718749998), (-1470.6331787109
348, -13679.261718749998), U]
target range = -13679.261718749998=>-13679.261718749998
Exception in thread "main" java.lang.InternalError: backstepping from -13679.261718749998 to -13679.261718749998
        at sun.awt.geom.Curve.compareTo(Curve.java:457)
        at sun.awt.geom.Order1.compareTo(Order1.java:197)
        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.pathToCurves(Area.java:173)
        at java.awt.geom.Area.transform(Area.java:492)
        at AreaTest.<init>(areaTest.java:30)
        at AreaTest.main(areaTest.java:38)

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------

import java.awt.geom.GeneralPath;
import java.awt.geom.Area;
import java.awt.geom.AffineTransform;

public class AreaTest {
  public AreaTest() {

    double angle = Math.PI / 8d;
    AffineTransform t = new AffineTransform();
    t.rotate(angle);

    GeneralPath path = new GeneralPath();
    path.moveTo( -1470.6331984752417f, -13679.261247085042f);
    path.quadTo( -3303.018649465366f, -13679.261247085042f, -5320.065076739477f,
                -12843.77326097191f);
    path.quadTo( -14301.0980122817f, -9123.707614950872f, -8981.032935542218f,
                3720.065646021036f);
    path.quadTo( -7001.947665555501f, 8498.000145915787f, -4516.23223633003f,
                10983.71557514126f);
    path.quadTo( -3069.6527602956367f, 12430.295051175652f,
                -1451.4908513919768f, 13100.559659959084f);
    path.quadTo( -54.38163118565376f, 13679.261247085042f, 1470.6331984752403f,
                13679.261247085042f);
    path.closePath();

    Area area = new Area(path);

    for (int i = 0; i < 8; i++) {
      area.transform(t);
    }

    System.out.println("Works with jdk1.5.0");

  }

  public static void main(String[] args) {
    AreaTest areatest = new AreaTest();
  }
}
---------- END SOURCE ----------

Release Regression From : 5.0
The above release value was the last known release where this 
bug was known to work. Since then there has been a regression.

Comments
EVALUATION Was fixed by skipping horisontal segments obtained during splitting curves into monotonic parts.
02-03-2006

EVALUATION We've gotten an InternalError exception because of splitting of one of the Area segments by tiny stepping value. Such splitting is necessary because we need to store only monotonic by y-coordinate segments. Using such tiny stepping value in the curve splitting code produces (due finite precision of calculations) quadratic curve laying on horizontal line which isn't allowed. So, InternalError happens. Here is some of the possible solutions: - not splitting with stepping parameter close to the 0 or 1 - skipping curves laying on the horizontal lines
21-02-2006

EVALUATION This problem was caused by the fix of the 4632108. After unrolling the fix test case from bug report has passed.
17-02-2006