JDK-6307563 : Unxpected IAE at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_2000
  • CPU: generic
  • Submitted: 2005-08-08
  • Updated: 2011-01-19
  • Resolved: 2005-08-31
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availabitlity Release.

To download the current JDK release, click here.
6 b50Fixed
Related Reports
Duplicate :  
Relates :  
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.

EVALUATION 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.

EVALUATION 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.

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.