8148127: IllegalArgumentException thrown by JCK test api/java_awt/Component/FlipBufferStrategy/indexTGF_General in opengl pipeline
authorpsadhukhan
Wed, 27 Jan 2016 14:13:48 +0530
changeset 35983 569084822dc1
parent 35982 cdcfde3520fa
child 35984 7f192a93c793
8148127: IllegalArgumentException thrown by JCK test api/java_awt/Component/FlipBufferStrategy/indexTGF_General in opengl pipeline Reviewed-by: flar, arapte
jdk/src/java.desktop/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java
--- a/jdk/src/java.desktop/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java	Wed Jan 27 14:12:05 2016 +0530
+++ b/jdk/src/java.desktop/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java	Wed Jan 27 14:13:48 2016 +0530
@@ -323,8 +323,12 @@
     @Override
     public VolatileImage createBackBuffer(WComponentPeer peer) {
         Component target = (Component)peer.getTarget();
+        // it is possible for the component to have size 0x0, adjust it to
+        // be at least 1x1 to avoid IAE
+        int w = Math.max(1, target.getWidth());
+        int h = Math.max(1, target.getHeight());
         return new SunVolatileImage(target,
-                                    target.getWidth(), target.getHeight(),
+                                    w, h,
                                     Boolean.TRUE);
     }