Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6668439
Votes 0
Synopsis D3D: Illegal argument exception when setting window size to {0,0}
Category java:classes_2d
Reported Against b11
Release Fixed 6u10(b22)
State 10-Fix Delivered, Verified, bug
Priority: 2-High
Related Bugs
Submit Date 27-FEB-2008
Description
happens on 1.6.0_10-ea-b11 and previous u10 builds
When you try to set window size to {0,0} an exeption appears. It works without problem on all JDK versions prior to u10

[java] SEVERE [global]
[java] java.lang.IllegalArgumentException: Width (0) and height (0) cannot
be <= 0
[java] at
java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:999)
[java] at
sun.awt.image.SunVolatileImage.getBackupImage(SunVolatileImage.java:225)
[java] at
sun.awt.image.VolatileSurfaceManager.getBackupSurface(VolatileSurfaceManager.java:252)
[java] at
sun.awt.image.VolatileSurfaceManager.initialize(VolatileSurfaceManager.java:108)
[java] at sun.awt.image.SunVolatileImage.<init>(SunVolatileImage.java:72)
[java] at sun.awt.image.SunVolatileImage.<init>(SunVolatileImage.java:82)
[java] at sun.awt.image.SunVolatileImage.<init>(SunVolatileImage.java:93)
[java] at
sun.java2d.d3d.D3DGraphicsConfig.createBackBuffer(D3DGraphicsConfig.java:148)
[java] at
sun.awt.windows.WComponentPeer.replaceSurfaceData(WComponentPeer.java:400)
[java] at
sun.awt.windows.WComponentPeer.replaceSurfaceData(WComponentPeer.java:367)
[java] at sun.awt.windows.WComponentPeer.setBounds(WComponentPeer.java:149)
[java] at sun.awt.windows.WWindowPeer.setBounds(WWindowPeer.java:514)
[java] at java.awt.Component.reshapeNativePeer(Component.java:2059)
[java] at java.awt.Component.reshape(Component.java:2007)
[java] at java.awt.Window.reshape(Window.java:776)
[java] at java.awt.Component.setBounds(Component.java:1973)
[java] at java.awt.Window.setBounds(Window.java:3114)


This code cause the exception

public static void main(String[] args) {
        // TODO code application logic here
        JFrame f = new JFrame();
        f.setUndecorated(true);
        f.setBounds(100, 100, 320, 240);
        f.setVisible(true);
        try { Thread.sleep(1000); } catch (Exception z) {}
        f.setBounds(0, 0, 0, 0);
        try { Thread.sleep(1000); } catch (Exception z) {}
        f.dispose();
    }
Posted Date : 2008-03-10 10:50:25.0
Work Around
N/A
Evaluation
I don't see any exceptions when running a simple test with JDK 6u10-b12:

import java.awt.*;

public class Test
{
  public static void main(String[] args)
  {
    Frame f = new Frame();
    f.setBounds(100, 100, 320, 240);
    f.setVisible(true);
    try { Thread.sleep(1000); } catch (Exception z) {}
    f.setBounds(0, 0, 0, 0);
    try { Thread.sleep(1000); } catch (Exception z) {}
    f.dispose();
  }
}

Please, provide a test which can be used to reproduce the bug.
Posted Date : 2008-03-06 11:55:16.0

This code cause the exception

public static void main(String[] args) {
        // TODO code application logic here
        JFrame f = new JFrame();
        f.setUndecorated(true);
        f.setBounds(100, 100, 320, 240);
        f.setVisible(true);
        try { Thread.sleep(1000); } catch (Exception z) {}
        f.setBounds(0, 0, 0, 0);
        try { Thread.sleep(1000); } catch (Exception z) {}
        f.dispose();
    }
Posted Date : 2008-03-06 13:50:39.0

The problem is reproducible since at least JDK6u4-b01 and not reproducible with JDK6u1.
Posted Date : 2008-03-11 10:22:40.0

The exception occurs in WComponentPeer.replaceSurfaceData() method. According to the file history, this method is called from setBounds() since at least a couple of JDK releases ago, so the problem seems to be caused by some changes in Java2D.
Posted Date : 2008-03-11 10:42:46.0

The creation of 0x0 d3d surface fails, so we attempt to 
create a backup buffered image the size of 0x0, which fails
with IAE.

We should adjust the size of the back buffer to be at
leat 1x1. The surface creation would still fail (there
are minimum dimension restrictions on backbuffers), but
a 1x1 backup surface will be successfully created.

The software pipeline doesn't have this issue because the
size of the backbuffers is adjusted in BltBufferStrategy.

And this didn't happen in previous releases because apparently
DirectDraw was happy to create a 0x0 surface.
Posted Date : 2008-03-25 19:57:41.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang