8147077: IllegalArgumentException thrown by api/java_awt/Component/FlipBufferStrategy/indexTGF_General
authorpsadhukhan
Wed, 27 Jan 2016 14:12:05 +0530
changeset 35982 cdcfde3520fa
parent 35695 94398e8dffee
child 35983 569084822dc1
8147077: IllegalArgumentException thrown by api/java_awt/Component/FlipBufferStrategy/indexTGF_General Reviewed-by: flar, arapte
jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsConfig.java
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsConfig.java	Tue Jan 26 13:05:21 2016 +0300
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsConfig.java	Wed Jan 27 14:12:05 2016 +0530
@@ -452,8 +452,12 @@
     public VolatileImage createBackBufferImage(Component target,
                                                long backBuffer)
     {
+        // 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,
                                     Long.valueOf(backBuffer));
     }