JDK-4785208 : REGRESSION: JList - ArrayIndexOutOfBoundsException
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.1
  • Priority: P3
  • Status: Closed
  • Resolution: Not an Issue
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2002-11-26
  • Updated: 2003-05-06
  • Resolved: 2003-05-06
Related Reports
Relates :  
Description

Name: gm110360			Date: 11/26/2002


FULL PRODUCT VERSION :
  Today is 2002-11-18.
I downloaded the latest j2sdk1.4.1_01 a few days ago and removed it immediately
because it was crashing and I could not run my application that runs well under
j2sdk1.3.1

I did not get it because I removed the latest version of
j2sdk1.4.1_01 immediately due to frequent errors, and
reinstalled the j2sdk1.3.1


A DESCRIPTION OF THE PROBLEM :
I use more than one JList to select some information. As
soon as I start flipping between them I get errors that I
pasted below.

REGRESSION.  Last worked in version 1.3.1

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. create two JTextFields (to display selected info)
2. create JButton to refresh JLists (clear and reload)
3. create two JList
4. load information into JList a
5. load information into JList b
6. select info from JList a
7. select info from JList b
8. start flipping between them or press refresh button

EXPECTED VERSUS ACTUAL BEHAVIOR :
when I press the JButton the JList should get cleared and
info reloaded without the JButton getting stuck.

when I select info from JList it should be displayed
without crashing (below).

ERROR MESSAGES/STACK TRACES THAT OCCUR :
E:\apm>java Izm2002
java.lang.ArrayIndexOutOfBoundsException: -1 < 0
        at java.util.Vector.elementAt(Vector.java:437)
        at javax.swing.DefaultListModel.elementAt(DefaultListModel.java:247)
        at TabService$CompanyListener.valueChanged(TabService.java:491)
        at javax.swing.JList.fireSelectionValueChanged(JList.java:1318)
        at javax.swing.JList$ListSelectionHandler.valueChanged(JList.java:1332)
        at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSel
ectionModel.java:187)
        at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSel
ectionModel.java:167)
        at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSel
ectionModel.java:214)
        at javax.swing.DefaultListSelectionModel.removeIndexInterval(DefaultList
SelectionModel.java:546)
        at javax.swing.plaf.basic.BasicListUI$ListDataHandler.intervalRemoved(Ba
sicListUI.java:1560)
        at javax.swing.AbstractListModel.fireIntervalRemoved(AbstractListModel.j
ava:160)
        at javax.swing.DefaultListModel.clear(DefaultListModel.java:490)
        at TabService.clearListCompany(TabService.java:879)
        at TabService.servRefresh(TabService.java:807)
        at TabService$ServiceListener.valueChanged(TabService.java:399)
        at javax.swing.JList.fireSelectionValueChanged(JList.java:1318)
        at javax.swing.JList$ListSelectionHandler.valueChanged(JList.java:1332)
        at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSel
ectionModel.java:187)
        at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSel
ectionModel.java:157)
        at javax.swing.DefaultListSelectionModel.setValueIsAdjusting(DefaultList
SelectionModel.java:554)
        at javax.swing.JList.setValueIsAdjusting(JList.java:1672)
        at javax.swing.plaf.basic.BasicListUI$MouseInputHandler.mouseReleased(Ba
sicListUI.java:1370)
        at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:2
28)
        at java.awt.Component.processMouseEvent(Component.java:5093)
        at java.awt.Component.processEvent(Component.java:4890)
        at java.awt.Container.processEvent(Container.java:1566)
        at java.awt.Component.dispatchEventImpl(Component.java:3598)
        at java.awt.Container.dispatchEventImpl(Container.java:1623)
        at java.awt.Component.dispatchEvent(Component.java:3439)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3450
)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3165)

        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3095)
        at java.awt.Container.dispatchEventImpl(Container.java:1609)
        at java.awt.Window.dispatchEventImpl(Window.java:1585)
        at java.awt.Component.dispatchEvent(Component.java:3439)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:450)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
read.java:197)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:150)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:144)

        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)

        at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)



REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
If you really need this I will try to make some in the future. Looking at the
error listing that I am sending you might be able to fix the problem.
---------- END SOURCE ----------

CUSTOMER WORKAROUND :
going back to older version j2sdk1.3.1

Release Regression From : 1.3
The above release value was the last known release where this 
bug was known to work. Since then there has been a regression.

(Review ID: 167160) 
======================================================================

Comments
EVALUATION ====================================================================== Name: pzR10082 Date: 12/02/2002 It seems from the stack trace, it is the method TabService$CompanyListener.valueChanged() that is passing bad index into DefaultListModel.elementAt(). Not sure why it worked in 1.3.1. It may also be that TabService$CompanyListener is passed a bad ListSelectionEvent that returns wrong values from getFirstIndex() or getLastIndex(). Need source code to investigate this. ###@###.### ======================================================================
24-08-2004