Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6366126

List throws ArrayIndexOutOfBoundsException when pressing ENTER after removing all the items, Win32

XMLWordPrintable

    • 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.

            dcherepanov Dmitry Cherepanov
            pmohansunw Praveen Mohan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: