On Thu, 23 Jul 2026 06:43:01 GMT, Prasanta Sadhukhan <[email protected]> wrote:
> Test fails with NPE citing > > java.lang.NullPointerException: Cannot invoke "Object.getClass()" because > "<local0>" is null > at Test6505027.validate(Test6505027.java:108) > at > java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) > at java.base/java.lang.reflect.Method.invoke(Method.java:583) > at SwingTest.run(SwingTest.java:96) > at SwingTest.start(SwingTest.java:131) > at SwingTest.start(SwingTest.java:54) > at Test6505027.main(Test6505027.java:67) > > > which can happen when the internal frame has not received native focus yet, > or the Robot clickâs focus transfer has not completed. The test validates > focus owner immediately after clicking cell (1,1). > Robot `waitForIdle` and `delay `is added after cell click to give time before > current focus owner check is called. > Also, explicitly activated the internal frame after it has been added to the > desktop pane: > Also, `instanceof` check is used instead of > `component.getClass().equals(JComboBox.class)` because it handles null > cleanly and does not reject a valid subclass > > Additionally, `press()` and `validate() `was called in separate EDT and main > thread respectively which can cause issues like this, so made sure they are > called in same thread as SwingTest calls static methods in main thread. > > > Recurrent CI test execution is found to be ok. > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai). test/jdk/javax/swing/JInternalFrame/Test6505027.java line 87: > 85: frame.setSelected(true); > 86: } catch (PropertyVetoException ex) { > 87: throw new Error("could not select internal frame", ex); can we please use RuntimeException instead of Error - here and elsewhere. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/32019#discussion_r3646974988
