diff -r eb4d5334fccf -r 9e80dbac0293 jdk/src/share/classes/sun/java2d/opengl/OGLRenderer.java --- a/jdk/src/share/classes/sun/java2d/opengl/OGLRenderer.java Wed Dec 14 11:23:21 2011 +0900 +++ b/jdk/src/share/classes/sun/java2d/opengl/OGLRenderer.java Wed Dec 14 14:43:44 2011 +0400 @@ -27,6 +27,7 @@ import java.awt.Transparency; import java.awt.geom.Path2D; +import sun.java2d.InvalidPipeException; import sun.java2d.SunGraphics2D; import sun.java2d.loops.GraphicsPrimitive; import sun.java2d.pipe.BufferedRenderPipe; @@ -46,7 +47,12 @@ int ctxflags = sg2d.paint.getTransparency() == Transparency.OPAQUE ? OGLContext.SRC_IS_OPAQUE : OGLContext.NO_CONTEXT_FLAGS; - OGLSurfaceData dstData = (OGLSurfaceData)sg2d.surfaceData; + OGLSurfaceData dstData; + try { + dstData = (OGLSurfaceData)sg2d.surfaceData; + } catch (ClassCastException e) { + throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData); + } OGLContext.validateContext(dstData, dstData, sg2d.getCompClip(), sg2d.composite, null, sg2d.paint, sg2d, ctxflags); @@ -55,7 +61,12 @@ @Override protected void validateContextAA(SunGraphics2D sg2d) { int ctxflags = OGLContext.NO_CONTEXT_FLAGS; - OGLSurfaceData dstData = (OGLSurfaceData)sg2d.surfaceData; + OGLSurfaceData dstData; + try { + dstData = (OGLSurfaceData)sg2d.surfaceData; + } catch (ClassCastException e) { + throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData); + } OGLContext.validateContext(dstData, dstData, sg2d.getCompClip(), sg2d.composite, null, sg2d.paint, sg2d, ctxflags); @@ -69,7 +80,12 @@ int ctxflags = sg2d.surfaceData.getTransparency() == Transparency.OPAQUE ? OGLContext.SRC_IS_OPAQUE : OGLContext.NO_CONTEXT_FLAGS; - OGLSurfaceData dstData = (OGLSurfaceData)sg2d.surfaceData; + OGLSurfaceData dstData; + try { + dstData = (OGLSurfaceData)sg2d.surfaceData; + } catch (ClassCastException e) { + throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData); + } OGLContext.validateContext(dstData, dstData, sg2d.getCompClip(), sg2d.composite, null, null, null, ctxflags);