JDK-4845561 : RegTest-test javax/swing/JPopupMenu/4791569/bug4791569.java failed
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2003-04-09
  • Updated: 2003-08-25
  • Resolved: 2003-08-09
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.
Other
5.0 tigerFixed
Related Reports
Relates :  
Description

Name: aaR10208			Date: 04/09/2003


Filed By       : J2SE-SQA [###@###.###
JDK            : JDK1.5.0-b04
Testbase       : RegTest-test
Platform[s]    : Windows XP Pro
switch/Mode    : -server
Falling test[s]: javax/swing/JPopupMenu/4791569/bug4791569.java

Regression test javax/swing/JPopupMenu/4791569/bug4791569.java test fails on WinXP using JDK1.5.0-b04.
Please note, the sample code from the bug#4791569 (it's a bug the regression test is based on) works fine.

Test source location:
=====================
/java/re/jdk/1.5.0/promoted/latest/ws/j2se/test/javax/swing/JPopupMenu/4791569/bug4791569.java

jtr file location:
==================
/net/jtgb4u4c.sfbay/export/sail15/results/tiger/b04/regtest/win32/winXP_PRO_-server_smp_linux-16/workDir/test/javax/swing/JPopupMenu/4791569/bug4791569.jtr

How to reproduce:
=================
Run the following script (you may need to change its variables)

--- script start ---
#!/bin/sh
TESTBASE=k:/regtest.tiger/test
JDK=c:/j2sdk1.5.0
cp $TESTBASE/javax/swing/JPopupMenu/4791569/bug4791569.java .
cp $TESTBASE/javax/swing/regtesthelpers/JRobot.java .
cp $TESTBASE/javax/swing/regtesthelpers/Util.java .
$JDK/bin/javac *.java
$JDK/bin/java -showversion bug4791569
--- script end ---

Script output:
==============
java version "1.5.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b04)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b04, mixed mode)

Exception in thread "main" java.lang.RuntimeException: Accelerator didn't work
         at bug4791569.test(bug4791569.java:37)
         at bug4791569.main(bug4791569.java:47)

Test output (jtr part):
=======================
----------System.err:(14/775)----------
java.lang.RuntimeException: Accelerator didn't work
	at bug4791569.test(bug4791569.java:37)
	at bug4791569.main(bug4791569.java:47)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at com.sun.javatest.regtest.MainWrapper$MainThread.run(MainWrapper.java:82)
	at java.lang.Thread.run(Thread.java:534)

JavaTest Message: Test threw exception: java.lang.RuntimeException: Accelerator didn't work
JavaTest Message: shutting down test

STATUS:Failed.`main' threw exception: java.lang.RuntimeException: Accelerator didn't work
result: Failed. Execution failed: `main' threw exception: java.lang.RuntimeException: Accelerator didn't work


test result: Failed. Execution failed: `main' threw exception: java.lang.RuntimeException: Accelerator didn't work


Specific machine info:
======================
Hostname: linux-16
OS: Windows XP Pro

======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger FIXED IN: tiger INTEGRATED IN: tiger tiger-b15 VERIFIED IN: tiger
24-08-2004

SUGGESTED FIX Name: azR10139 Date: 04/11/2003 ------- BasicPopupMenuUI.java ------- *** /tmp/sccs.kdaqw2 Fri Apr 11 18:30:41 2003 --- BasicPopupMenuUI.java Fri Apr 11 18:30:07 2003 *************** *** 344,350 **** } if (matches == 0) { ! ; // no op (consume) } else if (matches == 1) { // Invoke the menu action JMenuItem item = (JMenuItem)items[firstMatch]; --- 344,350 ---- } if (matches == 0) { ! ; // no op } else if (matches == 1) { // Invoke the menu action JMenuItem item = (JMenuItem)items[firstMatch]; *************** *** 356,361 **** --- 356,362 ---- manager.clearSelectedPath(); item.doClick(); } + e.consume(); } else { // Select the menu item with the matching mnemonic. If // the same mnemonic has been invoked then select the next *************** *** 368,375 **** System.arraycopy(path, 0, newPath, 0, path.length); newPath[path.length] = newItem; manager.setSelectedPath(newPath); } - e.consume(); return; } --- 369,376 ---- System.arraycopy(path, 0, newPath, 0, path.length); newPath[path.length] = newItem; manager.setSelectedPath(newPath); + e.consume(); } return; } ======================================================================
24-08-2004

EVALUATION Name: azR10139 Date: 04/11/2003 The reason of this bug is that BasicPopupMenuUI$BasicMenuKeyListener.menuKeyPressed(MenuKeyEvent) method consumes all the events created by pressing alphanumeric keys even if this key do not match any mnemonic. The idea of suggested fix is to consume event only if we are found at least one mnemonic that matches character entered by key press. ###@###.### 04/11/2003 ======================================================================
11-04-2003