# HG changeset patch # User avu # Date 1464281926 -10800 # Node ID bee3f6dd5e7e431bdfc7fc22ca46d2a9209b4634 # Parent 509853dd7d6c3c62fccba88145be84ff3ce3baad 7172749: Xrender: Class cast exception in 2D code running an AWT regression test Reviewed-by: serb, prr diff -r 509853dd7d6c -r bee3f6dd5e7e jdk/src/java.desktop/unix/classes/sun/java2d/xr/XRRenderer.java --- a/jdk/src/java.desktop/unix/classes/sun/java2d/xr/XRRenderer.java Fri May 20 00:03:45 2016 -0700 +++ b/jdk/src/java.desktop/unix/classes/sun/java2d/xr/XRRenderer.java Thu May 26 19:58:46 2016 +0300 @@ -28,6 +28,7 @@ import java.awt.*; import java.awt.geom.*; import sun.awt.SunToolkit; +import sun.java2d.InvalidPipeException; import sun.java2d.SunGraphics2D; import sun.java2d.loops.*; import sun.java2d.pipe.Region; @@ -69,7 +70,12 @@ * destination context. */ private final void validateSurface(SunGraphics2D sg2d) { - XRSurfaceData xrsd = (XRSurfaceData) sg2d.surfaceData; + XRSurfaceData xrsd; + try { + xrsd = (XRSurfaceData) sg2d.surfaceData; + } catch (ClassCastException e) { + throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData); + } xrsd.validateAsDestination(sg2d, sg2d.getCompClip()); xrsd.maskBuffer.validateCompositeState(sg2d.composite, sg2d.transform, sg2d.paint, sg2d);