JDK-4931726 : Reg test LineClipTest throws ClassCastException
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 5.0
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic,linux,solaris_9
  • CPU: generic,x86
  • Submitted: 2003-10-02
  • Updated: 2003-10-27
  • Resolved: 2003-10-27
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 Availability Release.

To download the current JDK release, click here.
Other
5.0 b26Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Description
The regression test test/sun/java2d/volatileImage/LineClipTest.java throws
ClassCastException on certain platforms.  This issue was reported as part of
4915527, but I am filing it here as a separate issue.  Here's the relevant
portion of that bug description:

This test also fails on our Solaris 10 (x86) box (CDE)
(SunOS linux-18 5.10 s10_36 i86pc i386 i86pc)
with JDK1.5.0(tested with b15-b18)
producing the following output in its jtr:

----------System.out:(1/7)----------
PASSED
----------System.err:(33/2234)----------
STATUS:Passed.
java.lang.ClassCastException: sun.awt.image.WritableRasterNative
	at sun.awt.image.BufImgSurfaceData.createDataBC(BufImgSurfaceData.java:259)
	at sun.awt.image.BufImgSurfaceData.createData(BufImgSurfaceData.java:108)
	at sun.awt.image.VolatileSurfaceManager.getBackupSurface(VolatileSurfaceManager.java:243)
	at sun.awt.image.VolatileSurfaceManager.restoreContents(VolatileSurfaceManager.java:265)
	at sun.java2d.SurfaceData.restoreContents(SurfaceData.java:122)
	at sun.awt.X11SurfaceData$X11PixmapSurfaceData.getReplacement(X11SurfaceData.java:522)
	at sun.java2d.pipe.DrawImage.renderSurfaceData(DrawImage.java:354)
	at sun.java2d.pipe.DrawImage.copyImage(DrawImage.java:65)
	at sun.java2d.pipe.DrawImage.copyImage(DrawImage.java:48)
	at sun.java2d.pipe.DrawImage.copyImage(DrawImage.java:732)
	at sun.java2d.SunGraphics2D.drawImage(SunGraphics2D.java:2804)
	at sun.java2d.SunGraphics2D.drawImage(SunGraphics2D.java:2794)
	at LineClipTest.paint(LineClipTest.java:276)
	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:1647)
	at sun.awt.RepaintArea.paintComponent(RepaintArea.java:201)
	at sun.awt.RepaintArea.paint(RepaintArea.java:177)
	at sun.awt.motif.MComponentPeer.handleEvent(MComponentPeer.java:391)
	at java.awt.Component.dispatchEventImpl(Component.java:3995)
	at java.awt.Container.dispatchEventImpl(Container.java:1962)
	at java.awt.Window.dispatchEventImpl(Window.java:1729)
	at java.awt.Component.dispatchEvent(Component.java:3770)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:214)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
STATUS:Failed.`main' threw exception: java.lang.ClassCastException: sun.awt.image.WritableRasterNative

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger-beta FIXED IN: tiger-beta INTEGRATED IN: tiger-b26 tiger-beta
14-06-2004

EVALUATION It's not clear yet why the restoreSurface() case is being hit on X11. However, the problem at hand is that VolatileSurfaceManager.getBackupSurface() attempts to create a new software surface using gc.createCompatibleImage(). When X11 acceleration is enabled, that method returns an X11RemoteOffScreenImage. So when we try to create a BufImgSurfaceData from that special kind of image, the ClassCastException is thrown because it does not understand the ROSI layout. This issue is very similar to the one described in 4912371. In fact, the solution here is to build off the fix for 4912371 in VSM.getBackupSurface(): instead of calling gc.createCompatibleImage(), we should call vImg.getSnapshot(), which will guarantee that we get back a "true" BufferedImage, not a special ROSI. ###@###.### 2003-10-02 The sData.getReplacement() is occurring due to an InvalidPipeException at the end of the test when the frame is going away and the bounds change. This in turn causes us to get a replacement SurfaceData and reattempt the operation. This mechanism seems to be working properly, so the fix suggested above should be sufficient to resolve the restoreSurface() issue. ###@###.### 2003-10-02
02-10-2003