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