Wrong characters in KeyEvents generated from input of barcode scanner
Hi everybody, :-)
I have a problem with KeyEvents coming from a barcode scanner. The issue seems to have creeped in somewhere between JSE 6u3 and 6u10, as in the former it works as expected and in the latter it does not. The problem persists still, we also tested it with 6u22 and 6u23 (all tests were performed on the same Windows XP machine). The actual test client is very simple, the application is only a JFrame containing a JTextField and a JTextArea.
The barcode scanner we use connects via USB and has no special driver. The scanner already decodes the barcode that was scanned and "enters" characters in the focussed text field of the test application by emulating the Alt+NumPad behaviour (the character '5' being produced by the equivalent of holding Alt and entering "0053" on the NumPad).
Now, what appears when the application is run in JSE 6u03 is the expected result:
5@WM010$|
5@WM010$|
5@WM010$|
5@WM010$|
...
Here's the result for the same barcode when the application is run in JSE 6u10 (results for 6u23 are similar):
5@WÞ10ä
é@—M010$|
5@W¥ð104|
5°ùM0ó(▄♀
5@W¥010$|
é@WM010Ü\
é@W¥010P\
5@wy010$|
5@m01Ð$▄
)°W¥01è$|
)@—0ÑÐ$|
Well, at least it manages to get some characters right every time... ;-)
The character values are wrong already when the KeyEvent for each is being created and posted to the EventQueue. But on the other hand, the problem is obviously tied to the JSE used, so it has to occur somewhere after Java receives the input and before a KeyEvent is generated. Since the errors are very random, we are guessing that it might be a timing problem.
Between JSE 6u3 and 6u10, KeyEvent has received some new members (here with their typical values for my use case):
#isSystemGenerated true
#primaryLevelUnicode 0
#rawCode 0
#scancode 0
Maybe the problem could have been introduced in the same changeset? Or maybe the values observed are meaningful in a way?
Can anybody enlighten me, or give me a hint of any kind? I already scoured the bug database but did not find anything.
Thanks! Any help is appreciated!
Regards, Lars