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

To download the current JDK release, click here.
JDK 7 JDK 8
7u40Fixed 8 b77Fixed
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
05-09-2013