Menu

#828 OS X FileChooser ArrayIndexOutOfBoundsException

4: Serious
open
nobody
5
2010-01-27
2010-01-27
No

https://sourceforge.net/tracker/?func=detail&atid=438935&aid=992525&group_id=44253
Created a copy of #992525 in an attempt to end the spam to that report.

I generate the following exception frequently (maybe 80% of
the time) when I request the Open or Save dialog. This is in
Mac OS X version 10.2.8, Java 1.4.1.

java.lang.ArrayIndexOutOfBoundsException: 1 >= 1
at java.util.Vector.elementAt(Vector.java:427)
at
javax.swing.DefaultListModel.get(DefaultListModel.java:428)
at
apple.laf.AquaFileChooserUI$FilterComboBoxModel.getSelect
edItem(AquaFileChooserUI.java:1312)
at
javax.swing.JComboBox.contentsChanged(JComboBox.java:1
263)
at
javax.swing.AbstractListModel.fireContentsChanged(Abstract
ListModel.java:100)
at
apple.laf.AquaFileChooserUI$FilterComboBoxModel.propertyC
hange(AquaFileChooserUI.java:1278)
at
javax.swing.event.SwingPropertyChangeSupport.fireProperty
Change(SwingPropertyChangeSupport.java:264)
at
javax.swing.event.SwingPropertyChangeSupport.fireProperty
Change(SwingPropertyChangeSupport.java:232)
at
javax.swing.JComponent.firePropertyChange(JComponent.jav
a:3814)
at
javax.swing.JFileChooser.addChoosableFileFilter(JFileChooser
.java:1073)
at
javax.swing.JFileChooser.resetChoosableFileFilters(JFileChoo
ser.java:1114)
at
edu.rice.cs.drjava.ui.MainFrame$3.getFiles(MainFrame.java:
326)
at
edu.rice.cs.drjava.ui.MainFrame._openFileOrProject(MainFra
me.java:2025)
at
edu.rice.cs.drjava.ui.MainFrame.access$1200(MainFrame.jav
a:101)
at
edu.rice.cs.drjava.ui.MainFrame$11.actionPerformed(MainFr
ame.java:436)
at
javax.swing.AbstractButton.fireActionPerformed(AbstractButt
on.java:1797)
at
javax.swing.AbstractButton$ForwardActionEvents.actionPerfo
rmed(AbstractButton.java:1850)
at
javax.swing.DefaultButtonModel.fireActionPerformed(Default
ButtonModel.java:419)
at
javax.swing.DefaultButtonModel.setPressed(DefaultButtonMo
del.java:257)
at
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(B
asicButtonListener.java:247)
at
java.awt.AWTEventMulticaster.mouseReleased(AWTEventMul
ticaster.java:227)
at
java.awt.Component.processMouseEvent(Component.java:50
93)
at
java.awt.Component.processEvent(Component.java:4890)
at
java.awt.Container.processEvent(Container.java:1566)
at
java.awt.Component.dispatchEventImpl(Component.java:359
8)
at
java.awt.Container.dispatchEventImpl(Container.java:1623)
at
java.awt.Component.dispatchEvent(Component.java:3439)
at
java.awt.LightweightDispatcher.retargetMouseEvent(Containe
r.java:3450)
at
java.awt.LightweightDispatcher.processMouseEvent(Containe
r.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(E
ventDispatchThread.java:230)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(Eve
ntDispatchThread.java:183)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThr
ead.java:177)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThr
ead.java:169)
at
java.awt.EventDispatchThread.run(EventDispatchThread.java
:99)

Date: 2004-11-22 15:45
Sender: dlsmithProject Admin
Hide

Logged In: YES
user_id=1060117

I've discovered this to be a bug in my system's implementation of
the JFileChooser. Under the following platform:

Mac OS 10.2.8
Java 1.4.1
Look and feel: apple.laf.AquaLookAndFeel

The methods JFileChooser.removeChoosableFileFilter() and
JFileChooser.resetChoosableFileFilters() cause an
ArrayIndexOutOfBoundsException under most conditions. I've
attached a simple program that breaks on this platform.

Since the JFileChoosers in edu.rice.cs.drjava.ui.MainFrame make
some use of the broken methods, an error occurs whenever a
JFileChooser is opened.

I'd recommend one of the following courses of action:

- Remove the calls to JFileChooser.removeChoosableFileFilter()
and JFileChooser.resetChoosableFileFilters() in MainFrame.java -- I
believe the functionality could be preserved without relying on
those methods.

- Write a test in the DrJava startup sequence that determines, for
each available look and feel (or maybe just the Apple look and
feel), whether the broken methods are implemented correctly. If
not, remove them from the list of available lafs.

- Abandon full support for Mac OS 10.2. The workaround is to
always use one of the Sun lafs.

Date: 2004-08-12 08:18
Sender: dlsmithProject Admin
Hide

Logged In: YES
user_id=1060117

The bug is still present in the most recent CVS version, checked
out today. Here's the edu.rice.cs.drjava portion of the stack trace
(the rest is identical):

java.lang.ArrayIndexOutOfBoundsException: 1 >= 1
...
at
edu.rice.cs.drjava.ui.MainFrame$3.getFiles(MainFrame.java:332)
at
edu.rice.cs.drjava.ui.MainFrame._openFileOrProject(MainFrame.jav
a:2426)
at
edu.rice.cs.drjava.ui.MainFrame.access$1500(MainFrame.java:105
)
at
edu.rice.cs.drjava.ui.MainFrame$14.actionPerformed(MainFrame.ja
va:471)
...

Date: 2004-07-16 15:14
Sender: dlsmithProject Admin
Hide

Logged In: YES
user_id=1060117

Some experimentation has shown this to be a bug introduced
between the 20040331 and 20040618 development releases.

Discussion


Log in to post a comment.