JDK-4922218 : OGL: ClassCastException if default visual is not GLX-enabled
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2003-09-12
  • Updated: 2003-11-07
  • Resolved: 2003-11-07
Related Reports
Duplicate :  
Description
The following exception may be encountered if the OpenGL pipeline is enabled
and the default visual is not GLX-enabled:

Exception in thread "main" java.lang.ClassCastException:
sun.awt.X11GraphicsConfig
        at sun.java2d.opengl.GLXSurfaceData.getGC(GLXSurfaceData.java:90)
        at sun.java2d.opengl.GLXSurfaceData.createData(GLXSurfaceData.java:59)

        at
sun.java2d.opengl.GLXVolatileSurfaceManager.initAcceleratedSurface(GLXVolatileSurfaceManager.java:57)

        at
sun.awt.image.VolatileSurfaceManager.initialize(VolatileSurfaceManager.java:93)

        at sun.awt.image.SunVolatileImage.<init>(SunVolatileImage.java:60)
        at sun.awt.image.SunVolatileImage.<init>(SunVolatileImage.java:46)
        at sun.awt.image.SunVolatileImage.<init>(SunVolatileImage.java:72)
        at
sun.java2d.opengl.GLXGraphicsConfig.createBackBufferImage(GLXGraphicsConfig.java:221)

        at sun.awt.X11.XComponentPeer.createBuffers(XComponentPeer.java:1197)
        at
java.awt.Component$FlipBufferStrategy.createBuffers(Component.java:3318)
        at java.awt.Component$FlipBufferStrategy.<init>(Component.java:3287)
        at java.awt.Component.createBufferStrategy(Component.java:3196)
        at java.awt.Window.createBufferStrategy(Window.java:2081)
        at java.awt.Component.createBufferStrategy(Component.java:3128)
        at java.awt.Window.createBufferStrategy(Window.java:2056)
        at XformMB.<init>(XformMB.java:53)
        at XformMB.main(XformMB.java:163)


Comments
EVALUATION There is some code in GLXSurfaceData.java which assumes that it can safely cast the default GraphicsConfig to GLXGraphicsConfig: // REMIND: this should rarely (never?) happen, but what if // default config is not GLX? GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice gd = env.getDefaultScreenDevice(); return (GLXGraphicsConfig)gd.getDefaultConfiguration(); Well, I guess we have the answer to the question posed in the "REMIND" statement. We should figure out why we are hitting this case, and how we can avoid it. ###@###.### 2003-09-12 The exception is thrown because the SunVolatileImage's Component has not been set by the time we go into GLXVolatileSurfaceManager.initAcceleratedSurface(). And the reason SVI.comp is null at this point is because of the same issue discovered in the fix for 4931726: this.comp is set after the shared constructor code is executed in SVI. Therefore, this particular failure should no longer be reproducible since the fix for 4931726 was putback. I will verify that this is the case before closing this bug. ###@###.### 2003-10-21 Verified that this problem is no longer reproducible, due to the fix for 4931726. ###@###.### 2003-11-06
21-10-2003