On Sun, 26 Jul 2026 06:22:16 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).
>
> Prasanta Sadhukhan has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Error->RuntimeException

Marked as reviewed by prr (Reviewer).

-------------

PR Review: https://git.openjdk.org/jdk/pull/32019#pullrequestreview-4791890107

Reply via email to