changeset 11686:907689a62eab

7172749: Xrender: Class cast exception in 2D code running an AWT regression test Reviewed-by: serb, prr
author serb
date Fri, 27 May 2016 19:12:18 +0300
parents f3bbeacf8118
children 4d6c03fb1039
files src/solaris/classes/sun/java2d/xr/XRRenderer.java
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/solaris/classes/sun/java2d/xr/XRRenderer.java	Fri May 27 18:29:14 2016 +0300
+++ b/src/solaris/classes/sun/java2d/xr/XRRenderer.java	Fri May 27 19:12:18 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);