JDK-8211703 : JInternalFrame : java.lang.AssertionError: cannot find the internal frame
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 9,10,11,12
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: generic
  • Submitted: 2018-10-04
  • Updated: 2021-10-16
  • Resolved: 2019-05-23
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.
JDK 11 JDK 13 JDK 14
11.0.7-oracleFixed 13 b24Fixed 14Fixed
Description
This issue is coming from below code piece (/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java) :

    JInternalFrame findInternalFrame(Component comp) {
        if (comp.getParent() instanceof BasicInternalFrameTitlePane) {
            comp = comp.getParent();
        }
        if (comp instanceof JInternalFrame) {
            return  (JInternalFrame)comp;
        } else if (comp instanceof JInternalFrame.JDesktopIcon) {
            return ((JInternalFrame.JDesktopIcon)comp).getInternalFrame();
        }
        assert false : "cannot find the internal frame";
        return null;
    }

Here it accepting BasicInternalFrameTitlePane in the first if check, but whenever a BasicInternalFrameTitlePane comes in to this method, it always end up with this assertion error.

How to reproduce:
Copy the attached test file(InternalFrameDemoTest) under location : /test/jdk/sanity/client/SwingSet/src
Run using jtreg command : ./jtreg/bin/jtreg -verbose:all -esa -jdk:./testjdk/jdk-12 -dir:./jdklocal/test/jdk sanity/client/SwingSet/src/InternalFrameDemoTest.java

Here '-esa' is important to include in the command, then only assertion codes will get executed.

Logs:
java.lang.AssertionError: cannot find the internal frame
	at java.desktop/com.sun.java.swing.plaf.gtk.Metacity.findInternalFrame(Metacity.java:340)
	at java.desktop/com.sun.java.swing.plaf.gtk.Metacity.updateFrameGeometry(Metacity.java:1474)
	at java.desktop/com.sun.java.swing.plaf.gtk.Metacity.paintButtonBackground(Metacity.java:219)
	at java.desktop/com.sun.java.swing.plaf.gtk.GTKPainter.paintButtonBackground(GTKPainter.java:273)
	at java.desktop/javax.swing.plaf.synth.SynthButtonUI.paintBackground(SynthButtonUI.java:294)
	at java.desktop/javax.swing.plaf.synth.SynthButtonUI.update(SynthButtonUI.java:251)
	at java.desktop/javax.swing.JComponent.paintComponent(JComponent.java:797)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1074)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1083)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1083)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1083)
	at java.desktop/javax.swing.JLayeredPane.paint(JLayeredPane.java:590)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1083)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1083)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1083)
	at java.desktop/javax.swing.JLayeredPane.paint(JLayeredPane.java:590)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1083)
	at java.desktop/javax.swing.JComponent.paintToOffscreen(JComponent.java:5255)
	at java.desktop/javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:246)
	at java.desktop/javax.swing.RepaintManager.paint(RepaintManager.java:1323)
	at java.desktop/javax.swing.JComponent._paintImmediately(JComponent.java:5203)
	at java.desktop/javax.swing.JComponent.paintImmediately(JComponent.java:5013)
	at java.desktop/javax.swing.RepaintManager$4.run(RepaintManager.java:888)
	at java.desktop/javax.swing.RepaintManager$4.run(RepaintManager.java:848)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:848)
	at java.desktop/javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:823)
	at java.desktop/javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:772)
	at java.desktop/javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1890)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
	at org.netbeans.jemmy.QueueTool$JemmyQueue.dispatchEvent(QueueTool.java:654)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
STATUS:Failed.`main' threw exception: java.lang.AssertionError: cannot find the internal frame
Comments
Fix request (11u) I would like to downport this for parity with 11.0.7-oracle. Applies clean.
27-12-2019

URL: http://hg.openjdk.java.net/jdk/jdk/rev/e448d58051ab User: psadhukhan Date: 2019-06-04 08:52:03 +0000
04-06-2019

URL: http://hg.openjdk.java.net/jdk/client/rev/e448d58051ab User: psadhukhan Date: 2019-05-23 05:21:36 +0000
23-05-2019