-
Bug
-
Resolution: Fixed
-
P2
-
1.4.2
-
b71
-
x86
-
windows_xp
-
Verified
I have a list with many items added to it. I am just removing all the items inside the itemStateChanged() method when the user selects an item. After this, I notice the following issues on Win32.
1. Focus still stays with the List even though all the items are removed.
2. Clicking the focus border shown on the top triggers an ItemEvent for List.
3. Pressing 'ENTER' throws an ArrayIndexOutOfBoundsException.
Issue [3] is a regression in 1.4.2 or 1.4.1 since it is not reproducible on 1.4. This is noticed only on Win32 and works fine on XToolkit.
Here is the exception:
Exception in thread "AWT-EventQueue-0"
java.lang.ArrayIndexOutOfBoundsException: 0 >= 0
at java.util.Vector.elementAt(Vector.java:434)
at java.awt.List.getItemImpl(List.java:292)
at java.awt.List.getItem(List.java:284)
at sun.awt.windows.WListPeer$1.run(WListPeer.java:176)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
I have attached a sample test. Execute the sample test. Click on any of the items in the list. Once all the items are removed, press ENTER. You would see the above exception on the console.
1. Focus still stays with the List even though all the items are removed.
2. Clicking the focus border shown on the top triggers an ItemEvent for List.
3. Pressing 'ENTER' throws an ArrayIndexOutOfBoundsException.
Issue [3] is a regression in 1.4.2 or 1.4.1 since it is not reproducible on 1.4. This is noticed only on Win32 and works fine on XToolkit.
Here is the exception:
Exception in thread "AWT-EventQueue-0"
java.lang.ArrayIndexOutOfBoundsException: 0 >= 0
at java.util.Vector.elementAt(Vector.java:434)
at java.awt.List.getItemImpl(List.java:292)
at java.awt.List.getItem(List.java:284)
at sun.awt.windows.WListPeer$1.run(WListPeer.java:176)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
I have attached a sample test. Execute the sample test. Click on any of the items in the list. Once all the items are removed, press ENTER. You would see the above exception on the console.
- relates to
-
JDK-6374308 redundant ItemEvent/ActionEvent is triggered for empty List, XAWT
- Resolved
-
JDK-8196394 [macosx] Test java/awt/List/EmptyListEventTest/EmptyListEventTest.java with timeout error
- Closed