JDK-8160623 : [PIT] Exception running java/awt/event/KeyEvent/KeyChar/KeyCharTest.java
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 9
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows
  • Submitted: 2016-06-30
  • Updated: 2017-11-29
  • Resolved: 2016-06-30
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 8 JDK 9
8u152Fixed 9 b127Fixed
Related Reports
Relates :  
Description
The test is java/awt/event/KeyEvent/KeyChar/KeyCharTest.java.

First, in this PIT build there is a new quite unexpected exception running Windows (7 and 10) (plus a dump of some EncodeD): 

java.lang.IllegalArgumentException: invalid keyChar
        at java.awt.event.KeyEvent.<init>(java.desktop@9-ea/KeyEvent.java:1172)
        at sun.awt.windows.WToolkit.eventLoop(java.desktop@9-ea/Native Method)
        at sun.awt.windows.WToolkit.run(java.desktop@9-ea/WToolkit.java:314)
        at java.lang.Thread.run(java.base@9-ea/Thread.java:843)

It is new in this PIT: b124 doesn't throw this.

Second, a test bug:
This test depends on a char returned by getKeyChar() from KEY_PRESSED and KEY_RELEASED. However that char is not necessary defined. According to the spec, "KEY_PRESSED and KEY_RELEASED events are not intended for reporting of character input." -- it's only KEY_TYPED event  must report a valid keychar.

As a result, the test fails on Windows with "Key char is not delete" and indeed, it is 0xFFFF (CHAR_UNDEFINED) which is expected. 
Comments
removed noreg-sqe label which applies only when an SQE test is used to verify. In this case, it is a regression test in the repo which failed.
30-06-2016

wchar[0] == 0 is a valid value for some known char conversions. So, JDK-8139189 took care about it for nothing. The fix: --- old/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp 2016-06-30 16:20:29.651974000 +0300 +++ new/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp 2016-06-30 16:20:29.194947900 +0300 @@ -3541,7 +3541,7 @@ BOOL deadKeyFlag = (converted == 2); // Dead Key - if (converted < 0 || wChar[0] == 0 || isDeadKey) { + if (converted < 0 || isDeadKey) { translation = java_awt_event_KeyEvent_CHAR_UNDEFINED; } else // No translation available -- try known conversions or else punt.
30-06-2016

Moreover, run this simple attached code on Windows and press Delete on the keyboard: IllegalArgumentException will be thrown. It may be a stopper as well.
30-06-2016

Perhaps due to this fx :- https://bugs.openjdk.java.net/browse/JDK-8139189
30-06-2016