[OpenJDK 2D-Dev] [9] RFR: JDK-8140530, , Creating a VolatileImage with size 0, 0 results in no longer working g2d.drawStri

prasanta sadhukhan prasanta.sadhukhan at oracle.com
Mon Nov 30 08:43:09 UTC 2015

Hi All,

Please review a fix for jdk9
Bug: https://bugs.openjdk.java.net/browse/JDK-8140530
webrev: http://cr.openjdk.java.net/~psadhukhan/8140530/webrev.00/

The issue was creating a volatileImage with 0 width, height does not 
result in IllegalArgumentException.
But, when we try to create a non-volatile Image via 
GraphicsConfiguration.createCompatibleImage(0,0) or a 
BufferedImage(0,0,imagetype) it results in IAE.
So, to maintain consistency across all image w.r.t 0 width,height, 
createVolatileImage() should also throw IAE.

In windows, creating a volatileImage with 0 width,height resulted in IAE 
but in linux it does not.

This is because XCreatePixmap() generate BadValue unless width,height is 
nonzero but the error handler does not catch it.
https://tronche.com/gui/x/xlib/pixmap-and-cursor/XCreatePixmap.html [The 
width and height arguments must be nonzero, or a *BadValue* error results.]

I have added a check to prevent zero width,height to be used for 
XCreatePixmap() and also throw OOME so to ask Java to throw IAE.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20151130/b18d0c7c/attachment.html>

More information about the 2d-dev mailing list