JDK-7003434 : test/closed/java/awt/FullScreen/DisplayChangeVITest/DisplayChangeVITest.java fails with ClassCastExc
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: generic
  • Submitted: 2010-11-30
  • Updated: 2014-08-26
  • Resolved: 2011-03-07
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.
JDK 7
7 b126Fixed
Related Reports
Relates :  
Description
#Test Results (version 2)
#Tue Nov 30 15:31:45 MSK 2010
#checksum:4bf8c839d66d9dbe
#-----testdescription-----
$file=K:\\flic1\\jdk\\test\\closed\\java\\awt\\FullScreen\\DisplayChangeVITest\\DisplayChangeVITest.java
$root=K:\\flic1\\jdk\\test
author=Dmitri Trembovetski area=FullScreen
keywords=bug6366359 othervm
run=USER_SPECIFIED main/othervm/timeout=200 DisplayChangeVITest\r\nUSER_SPECIFIED main/othervm/timeout=200 -Dsun.java2d.d3d=false DisplayChangeVITest\r\nUSER_SPECIFIED main/othervm/timeout=200 -Dsun.java2d.opengl=true DisplayChangeVITest\r\n
source=DisplayChangeVITest.java
title=Test that we don't crash when changing from 8 to 16/32 bit modes

#-----environment-----

#-----testresult-----
description=file:///K:/flic1/jdk/test/closed/java/awt/FullScreen/DisplayChangeVITest/DisplayChangeVITest.java
end=Tue Nov 30 15:31:45 MSK 2010
environment=regtest
execStatus=Failed. Execution failed: `main' threw exception: java.lang.ClassCastException: sun.awt.Win32GraphicsConfig cannot be cast to sun.java2d.opengl.WGLGraphicsConfig
javatestOS=Windows XP 5.1 (x86)
javatestVersion=2.1.5
script=com.sun.javatest.regtest.RegressionScript 
sections=script_messages build main build main build main
start=Tue Nov 30 15:30:37 MSK 2010
status=Failed. Execution failed: `main' threw exception: java.lang.ClassCastException: sun.awt.Win32GraphicsConfig cannot be cast to sun.java2d.opengl.WGLGraphicsConfig
test=closed/java/awt/FullScreen/DisplayChangeVITest/DisplayChangeVITest.java
work=K:\\flic1\\jdk\\test\\closed\\java\\awt\\FullScreen\\DisplayChangeVITest\\JTwork\\closed\\java\\awt\\FullScreen\\DisplayChangeVITest

#section:script_messages
----------messages:(4/176)----------
JDK under test: (E:/BOOTJDK/jdk7b119)
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b119)
Java HotSpot(TM) Client VM (build 20.0-b03, mixed mode)

#section:build
----------messages:(3/108)----------
command: build DisplayChangeVITest 
reason: Named class compiled on demand
elapsed time (seconds): 0.125
result: Passed. No need to compile: DisplayChangeVITest.java

#section:main
----------messages:(3/149)----------
command: main DisplayChangeVITest
reason: User specified action: run main/othervm/timeout=200 DisplayChangeVITest 
elapsed time (seconds): 32.266
----------System.out:(0/0)----------
----------System.err:(15/437)----------
Found display modes:
DisplayMode[800x600x8]
DisplayMode[1024x768x16]
DisplayMode[1280x960x32]
Entering DisplayMode[800x600x8]
Entering DisplayMode[1024x768x16]
Entering DisplayMode[1280x960x32]
Entering DisplayMode[800x600x8]
Entering DisplayMode[1024x768x16]
Entering DisplayMode[1280x960x32]
Entering DisplayMode[800x600x8]
Entering DisplayMode[1024x768x16]
Entering DisplayMode[1280x960x32]
Test Passed.
STATUS:Passed.
result: Passed. Execution successful

#section:build
----------messages:(3/108)----------
command: build DisplayChangeVITest 
reason: Named class compiled on demand
elapsed time (seconds): 0.046
result: Passed. No need to compile: DisplayChangeVITest.java

#section:main
----------messages:(3/194)----------
command: main  -Dsun.java2d.d3d=falseDisplayChangeVITest
reason: User specified action: run main/othervm/timeout=200 -Dsun.java2d.d3d=false DisplayChangeVITest 
elapsed time (seconds): 31.25
----------System.out:(0/0)----------
----------System.err:(15/437)----------
Found display modes:
DisplayMode[800x600x8]
DisplayMode[1024x768x16]
DisplayMode[1280x960x32]
Entering DisplayMode[800x600x8]
Entering DisplayMode[1024x768x16]
Entering DisplayMode[1280x960x32]
Entering DisplayMode[800x600x8]
Entering DisplayMode[1024x768x16]
Entering DisplayMode[1280x960x32]
Entering DisplayMode[800x600x8]
Entering DisplayMode[1024x768x16]
Entering DisplayMode[1280x960x32]
Test Passed.
STATUS:Passed.
result: Passed. Execution successful

#section:build
----------messages:(3/108)----------
command: build DisplayChangeVITest 
reason: Named class compiled on demand
elapsed time (seconds): 0.047
result: Passed. No need to compile: DisplayChangeVITest.java

#section:main
----------messages:(3/198)----------
command: main  -Dsun.java2d.opengl=trueDisplayChangeVITest
reason: User specified action: run main/othervm/timeout=200 -Dsun.java2d.opengl=true DisplayChangeVITest 
elapsed time (seconds): 3.766
----------System.out:(0/0)----------
----------System.err:(25/1561)----------
Found display modes:
DisplayMode[800x600x8]
DisplayMode[1024x768x16]
DisplayMode[1280x960x32]
Entering DisplayMode[800x600x8]
java.lang.ClassCastException: sun.awt.Win32GraphicsConfig cannot be cast to sun.java2d.opengl.WGLGraphicsConfig
	at sun.java2d.opengl.WGLVolatileSurfaceManager.initAcceleratedSurface(WGLVolatileSurfaceManager.java:106)
	at sun.awt.image.VolatileSurfaceManager.validate(VolatileSurfaceManager.java:174)
	at sun.awt.image.SunVolatileImage.validate(SunVolatileImage.java:250)
	at DisplayChangeVITest.initBackbuffer(DisplayChangeVITest.java:148)
	at DisplayChangeVITest.render(DisplayChangeVITest.java:70)
	at DisplayChangeVITest.run(DisplayChangeVITest.java:104)
	at java.lang.Thread.run(Thread.java:729)
	at DisplayChangeVITest.main(DisplayChangeVITest.java:208)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:613)
	at com.sun.javatest.regtest.MainWrapper$MainThread.run(MainWrapper.java:94)
	at java.lang.Thread.run(Thread.java:729)

JavaTest Message: Test threw exception: java.lang.ClassCastException: sun.awt.Win32GraphicsConfig cannot be cast to sun.java2d.opengl.WGLGraphicsConfig
JavaTest Message: shutting down test

STATUS:Failed.`main' threw exception: java.lang.ClassCastException: sun.awt.Win32GraphicsConfig cannot be cast to sun.java2d.opengl.WGLGraphicsConfig
result: Failed. Execution failed: `main' threw exception: java.lang.ClassCastException: sun.awt.Win32GraphicsConfig cannot be cast to sun.java2d.opengl.WGLGraphicsConfig


test result: Failed. Execution failed: `main' threw exception: java.lang.ClassCastException: sun.awt.Win32GraphicsConfig cannot be cast to sun.java2d.opengl.WGLGraphicsConfig


<h4>Execution failed: `main' threw exception: java.lang.ClassCastException: sun.awt.Win32GraphicsConfig cannot be cast to sun.java2d.opengl.WGLGraphicsConfig</h4>
<ul>
<li><a href="/K:\flic1\jdk\test\closed\java\awt\FullScreen\DisplayChangeVITest\JTwork\closed\java\awt\FullScreen\DisplayChangeVITest\DisplayChangeVITest.jtr">closed/java/awt/FullScreen/DisplayChangeVITest/DisplayChangeVITest.java</a>: Test that we don't crash when changing from 8 to 16/32 bit modes

Comments
EVALUATION http://hg.openjdk.java.net/jdk7/build/jdk/rev/70bfa0af3969
17-01-2011

EVALUATION The problem here is that test DisplayChangeVITest fails with a class cast exception on a certain box. The peculiarity of this box is that it is equipped with quite ancient video board (Nvidia Ti4200), which has some issues with OGL support. In particular, it declares support for 800x600x8 video mode, but fails to initialize this mode when it is requested. As a result, we fall back to GDI graphics environment to enable requested video mode. How we run into class caset exception: the test creates a volatile image to use it as a back buffer. This volatile image keeps references to graphics configuration and volatile surface manager which were initialized by instances of WGLGraphicsConfig and WGLVolatileSurfaceManager respectively. When we request video mode, unsupported by OGL driver, reference to graphics configuration is updated with a instance of Win32GraphicsConfif, but reference to volatile surface manager is not changed. As a result, when we request validation of the volatile image, we use wgl surface manager. It assumes that managed volatile image uses wgl graphics config and tries to perform explicit conversion, which results in observed ClassCastException. To prevent this, I suggest to modify isConfigValid() check of class WGLVolatileSurfaceManager in order to reject non-wgl configs. It leads to proper re-initialization of volatile image and prevents observed exceptions.
30-12-2010

SUGGESTED FIX http://sa.sfbay.sun.com/projects/java2d_data/7/7003434
30-12-2010