JDK-8041647 : "InternalError: not implemented" yet when drawRect with Xor is first invoked
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 7u45,8u5
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: windows_7
  • Submitted: 2013-10-24
  • Updated: 2021-07-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) Client VM (build 24.45-b08, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
We've seen this on Win XP, Vista, 7 and 8. The display adapter seems to be the key element.


EXTRA RELEVANT SYSTEM CONFIGURATION :
Display adapter:
AMD Radeon HD 7660G
ATI Mobility Radeon HD 3470
nVidia Quadro NVS 110M

Does NOT happen with
Intel HD graphics 2500
Mobile Intel(R) 965 Express chipset family

A DESCRIPTION OF THE PROBLEM :
"java.lang.InternalError: not implemented yet" when first invoke "SunGraphics2D.drawRect" on mouseMoved with Xor mode enabled, using certain display adapters..

ADDITIONAL REGRESSION INFORMATION:
This seems to be related to JDK-7153339 : InternalError when drawLine with Xor and Antialiasing

These are our testing results on affected machines. "line" refers to the drawLine test in bug 7153339, while "rect" refers to the drawRect test attached to this bug report.

7u25: "Unable to stroke" with both line & rect
7u45: no errors with line and "not implemented yet" with rect
8b111: no errors with line and "not implemented yet" with rect



STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run the test program provided being sure to use one of the indicated graphic display adapters.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
no errors
ACTUAL -
"InternalError: not implemented yet" on first invoke of drawRect

ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "AWT-EventQueue-0" java.lang.InternalError: not implemented yet
at sun.java2d.windows.GDIWindowSurfaceData.getRaster(Unknown Source)
at sun.java2d.loops.GeneralRenderer.doSetRect(Unknown Source)
at sun.java2d.loops.XorFillSpansANY.FillSpans(Unknown Source)
at sun.java2d.pipe.LoopPipe.fillSpans(Unknown Source)
at sun.java2d.pipe.LoopPipe.draw(Unknown Source)
at sun.java2d.pipe.PixelToShapeConverter.drawRect(Unknown Source)
at sun.java2d.pipe.ValidatePipe.drawRect(Unknown Source)
at sun.java2d.SunGraphics2D.drawRect(Unknown Source)
at com.qarbon.shasta.TestX$MyComp.paintRect(TestX.java:44)
at com.qarbon.shasta.TestX$MyComp.mouseMoved(TestX.java:34)
at java.awt.Component.processMouseMotionEvent(Unknown Source)
at javax.swing.JComponent.processMouseMotionEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.*;
import java.awt.event.*;

import javax.swing.*;

public class TestX
{
    private static Stroke DRAG_HIGHLIGHT_STROKE = new BasicStroke(1, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 1.0f, new float[]{0.0f, 2.0f}, 0.0f);

    public static void main(String[] args)
    {
        JFrame f = new JFrame();
        f.add(new MyComp());

        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setSize(500, 500);
        f.setLocationRelativeTo(null);
        f.setVisible(true);
    }

    private static class MyComp extends JLabel implements MouseMotionListener
    {
        public MyComp()
        {
            addMouseMotionListener(this);
        }

        @Override
        public void mouseMoved(MouseEvent e)
        {
            paintRect(getGraphics(), new Rectangle(100, 100, 200, 200));
        }
        
        protected static void paintRect(Graphics g, Rectangle r)
        {
            Graphics2D g2 = (Graphics2D) g;
            g2.setColor(Color.BLACK);
            g2.setStroke(DRAG_HIGHLIGHT_STROKE);
            g.setXORMode(Color.WHITE);

            g2.drawRect(r.x, r.y, r.width - 1, r.height - 1);
            g2.drawRect(r.x + 1, r.y + 1, r.width - 3, r.height - 3);
            g2.drawRect(r.x + 2, r.y + 2, r.width - 5, r.height - 5);
        }
        
        @Override
        public void mouseDragged(MouseEvent e)
        {
        }
    }
} 
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Catch the InternalError and silently ignore it if it's the "not implemented yet" one. The effect is that the rectangle is not drawn initially on affected machines but it's hard to notice and definitely better than the exception.
Comments
This problem was likely resolved by the fix for 8036022.
24-04-2014

Reproduced locally on 8u5
23-04-2014