[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
Tue Dec 1 05:58:56 UTC 2015


Modified the testcase to "fail" if IAE is not thrown
http://cr.openjdk.java.net/~psadhukhan/8140530/webrev.01

Regards
Prasanta
On 11/30/2015 2:13 PM, prasanta sadhukhan wrote:
> 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.
>
> Regards
> Prasanta

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


More information about the 2d-dev mailing list