JDK-8004821 : Graphics2D.drawPolygon() fails with IllegalPathStateException
  • Type: Bug
  • Status: Resolved
  • Resolution: Fixed
  • Component: client-libs
  • Sub-Component: 2d
  • Priority: P3
  • OS: generic
  • Submit Date: 2012-12-10
  • Updated Date: 2013-09-05
  • Resolved Date: 2013-02-04
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 Availabitlity Release.

To download the current JDK release, click here.
JDK 7 JDK 8
7u40Fixed 8 b77Resolved
Related Reports
Relates :  
Description
Graphics2D.drawPolygon(int xPoints[], int yPoints[], int nPoints) fails when arrays are empty and the graphics is scaled.
This caused jck failure, if default graphics transform is not an identity.

Log:
Exception in thread "main" java.awt.geom.IllegalPathStateException: missing initial moveto in path definition
	at java.awt.geom.Path2D$Float.needRoom(Path2D.java:280)
	at java.awt.geom.Path2D.closePath(Path2D.java:1771)
	at sun.java2d.pipe.PixelToShapeConverter.makePoly(PixelToShapeConverter.java:111)
	at sun.java2d.pipe.PixelToShapeConverter.drawPolygon(PixelToShapeConverter.java:125)
	at sun.java2d.pipe.ValidatePipe.drawPolygon(ValidatePipe.java:140)
	at sun.java2d.SunGraphics2D.drawPolygon(SunGraphics2D.java:2279)
Suggested fix:
http://cr.openjdk.java.net/~serb/8004821/webrev.00/


Comments
I created file DrawPolygonScaledTest.java for fix verification
2013-09-05