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: 6307563
Votes 0
Synopsis Unxpected IAE at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel
Category java:classes_swing
Reported Against
Release Fixed mustang(b50)
State 10-Fix Delivered, bug
Priority: 3-Medium
Related Bugs 6245040 , 6307564
Submit Date 08-AUG-2005
Description
Unexpected IllegalArgumentExc during the test.
How to reproduce:
1) Run the test from Comments (I belive the test may be easily reduced) on Windows2000 with JDK6.0b45 (or b40). You would see a frame with JTable in it.
2) Press left mouse button on the bottom of the frame and drag mouse up on the screen till the frame become a title.  You should do it fast enough may be for several times.
3) You may also see an Exception if drag top border of the frame.
The exception is:
Exception occurred during event dispatching:
java.lang.IllegalArgumentException: Width (592) and height (0) cannot be <= 0
	at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:999)
	at sun.awt.image.SunVolatileImage.getBackupImage(SunVolatileImage.java:214)
	at sun.awt.image.VolatileSurfaceManager.getBackupSurface(VolatileSurfaceManager.java:241)
	at sun.awt.image.VolatileSurfaceManager.initialize(VolatileSurfaceManager.java:103)
	at sun.awt.image.SunVolatileImage.<init>(SunVolatileImage.java:66)
	at sun.awt.image.SunVolatileImage.<init>(SunVolatileImage.java:75)
	at sun.awt.image.SunVolatileImage.<init>(SunVolatileImage.java:86)
	at sun.awt.image.SunVolatileImage.<init>(SunVolatileImage.java:80)
	at sun.awt.windows.WComponentPeer.createVolatileImage(WComponentPeer.java:536)
	at java.awt.Component.createVolatileImage(Component.java:3182)
	at java.awt.Component$BltBufferStrategy.createBackBuffers(Component.java:3819)
	at java.awt.Component$BltBufferStrategy.revalidate(Component.java:3926)
	at java.awt.Component$BltBufferStrategy.revalidate(Component.java:3911)
	at java.awt.Component$BltBufferStrategy.getDrawGraphics(Component.java:3835)
	at javax.swing.BufferStrategyPaintManager.prepare(BufferStrategyPaintManager.java:463)
	at javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:265)
	at javax.swing.RepaintManager.paint(RepaintManager.java:1052)
	at javax.swing.JComponent.paint(JComponent.java:994)
	at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:21)
	at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:60)
	at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:97)
	at java.awt.Container.paint(Container.java:1703)
	at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:689)
	at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:635)
	at javax.swing.RepaintManager.seqPaintDirtyRegions(RepaintManager.java:615)
	at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:128)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:590)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:270)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:198)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:171)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:166)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:158)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:119)

Seems this exception doesn't occur with pure AWT testcase. Believe it's in 2D part of JDK.
Posted Date : 2005-08-08 09:37:31.0
Work Around
N/A
Evaluation
I'm unable to reproduce this on my XP box.  Swing will not paint if the width/height of the component is <= 0, so I'm not sure how we end up trying to paint an empty content area.  Will try on win2k box in the lab.
Posted Date : 2005-08-18 14:19:22.0

I modified the test case to have a timer that asks for the graphics from the buffer strategy every second.  When I then shrink the window to a small height wise as possible I see the exception.
I see two options for fixing this:

. Force the size to always be > 0.
. If either size is < 1 don't create an image, and instead hand back a bogus Graphics.

Will consult with Chris as to the best approach.
Posted Date : 2005-08-19 13:35:54.0

This is a regression introduced in fixing 6245040.  In particular it was possible to try and create an image with a size <= 0, which will throw an exception.  The fix is to change the BltBuferStrategy to always create an image with a size > 0.
Posted Date : 2005-08-19 22:27:01.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang