JRE-12 CCE: XRTextRenderer.drawGlyphList (sun.java2d.NullSurfaceData cannot be cast to sun.java2d.xr.XRSurfaceData)

Throwing InvalidPipeException for incompatible surfaces

(cherry picked from commit f98f34c)
(cherry picked from commit fb2bbc47fe)
This commit is contained in:
Alexey Ushakov
2016-08-10 18:33:23 +03:00
committed by alexey.ushakov@jetbrains.com
parent ce2af57e84
commit eb1a8e6ed8

View File

@@ -26,6 +26,7 @@
package sun.font;
import sun.awt.*;
import sun.java2d.InvalidPipeException;
import sun.java2d.SunGraphics2D;
import sun.java2d.pipe.GlyphListPipe;
import sun.java2d.xr.*;
@@ -61,8 +62,12 @@ public class XRTextRenderer extends GlyphListPipe {
try {
SunToolkit.awtLock();
XRSurfaceData x11sd = (XRSurfaceData) sg2d.surfaceData;
XRSurfaceData x11sd;
try {
x11sd = (XRSurfaceData) sg2d.surfaceData;
} catch (ClassCastException e) {
throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
}
x11sd.validateAsDestination(null, sg2d.getCompClip());
x11sd.maskBuffer.validateCompositeState(sg2d.composite, sg2d.transform, sg2d.paint, sg2d);