changeset 35982:cdcfde3520fa

8147077: IllegalArgumentException thrown by api/java_awt/Component/FlipBufferStrategy/indexTGF_General Reviewed-by: flar, arapte
author psadhukhan
date Wed, 27 Jan 2016 14:12:05 +0530
parents 94398e8dffee
children 569084822dc1
files jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsConfig.java
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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));
     }