On Fri, 11 Jul 2025 17:44:53 GMT, Harshitha Onkar <hon...@openjdk.org> wrote:
> Suppose an exception occurs when testing the first case - 0x20 to 0x7E then > the finally block with NumLock is executed irrespective of whether the > NumLock was set for the next test case. This is not how it actually works. The try-catch-finally(with NumLock press/release) block executes on the main thread, and the exception is thrown on the EDT (line 52). The jtreg test failure is due to the exception on the EDT. It checks all the test cases with the NumLock key both on and off. For example, apply the following patch to the test to make it always fail within the first key range: - if (value != null && e.getKeyChar() != value) { + if (value != null && e.getKeyChar() != value || e.getKeyCode() == 0x21) { Observe the exception stack trace from EDT java.lang.RuntimeException: Wrong KeyChar on KEY_RELEASED Page Up at KeyCharTest.keyReleased(KeyCharTest.java:53) at java.desktop/java.awt.Component.processKeyEvent(Component.java:6537) at java.desktop/java.awt.Component.processEvent(Component.java:6353) at java.desktop/java.awt.Container.processEvent(Container.java:2260) at java.desktop/java.awt.Window.processEvent(Window.java:1966) at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4958) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2318) at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2671) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4790) at java.desktop/java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1829) at java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:874) at java.desktop/java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1136) at java.desktop/java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:1011) at java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:839) at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4839) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2318) at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2671) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4790) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:725) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:702) 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) However, I updated the test. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26170#discussion_r2201760433