JDK-6684952 : Exception occurred on JFileChooser in Applet
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6,6u4,6u10
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_2003,windows_xp
  • CPU: x86
  • Submitted: 2008-04-07
  • Updated: 2011-02-16
  • Resolved: 2008-08-11
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.
JDK 6 JDK 7
6u11Fixed 7Resolved
Related Reports
Duplicate :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.6.0_04"
Java(TM) SE Runtime Environment (build 1.6.0_04-b12)
Java HotSpot(TM) Client VM (build 10.0-b19, mixed mode, sharing)

I checked same exception occurred at 1.6.0_05 and 1.6.0_10 beta14.
But no error occurrd at 1.6.0_03 or before.

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
(Win XP Professional SP2 Japanese)

A DESCRIPTION OF THE PROBLEM :
JFileChooser in Applet, eceptions occurrd during select directory action by mouse clicked.
JFileChooser in Application, n error occurred.


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
(1) Download FileChooserDemo.java file from following URL;
http://java.sun.com/docs/books/tutorial/uiswing/examples/components/index.html#FileChooserDemo

(2) Make FileChooserDemoApplet.java file to start FileChooser in Applet ;
(3) Build these files and start FileChooserDemoApplet .

(4) Push "Open a File..." button, and select directory sometimes;
(I use Jpanese Windows, so Desktop and My Computer are in Japanese)
- Desktop
- My Documents
- My Computer
- etc.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No error occured.
ACTUAL -
Exception occurred.
Exception occurred during event dispatching:
java.lang.IndexOutOfBoundsException: Invalid index
or
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException


ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception occurred during event dispatching:
java.lang.IndexOutOfBoundsException: Invalid index
	at javax.swing.DefaultRowSorter.convertRowIndexToModel(Unknown Source)
	at sun.swing.FilePane$SortableListModel.getElementAt(Unknown Source)
	at javax.swing.plaf.basic.BasicListUI.paintCell(Unknown Source)
	at javax.swing.plaf.basic.BasicListUI.paintImpl(Unknown Source)
	at javax.swing.plaf.basic.BasicListUI.paint(Unknown Source)
	at javax.swing.plaf.ComponentUI.update(Unknown Source)
	at javax.swing.JComponent.paintComponent(Unknown Source)
	at javax.swing.JComponent.paint(Unknown Source)
	at javax.swing.JComponent.paintChildren(Unknown Source)
	at javax.swing.JComponent.paint(Unknown Source)
	at javax.swing.JViewport.paint(Unknown Source)
	at javax.swing.JComponent.paintChildren(Unknown Source)
	at javax.swing.JComponent.paint(Unknown Source)
	at javax.swing.JComponent.paintChildren(Unknown Source)
	at javax.swing.JComponent.paint(Unknown Source)
	at javax.swing.JComponent.paintChildren(Unknown Source)
	at javax.swing.JComponent.paint(Unknown Source)
	at javax.swing.JComponent.paintChildren(Unknown Source)
	at javax.swing.JComponent.paint(Unknown Source)
	at javax.swing.JComponent.paintChildren(Unknown Source)
	at javax.swing.JComponent.paint(Unknown Source)
	at javax.swing.JComponent.paintChildren(Unknown Source)
	at javax.swing.JComponent.paint(Unknown Source)
	at javax.swing.JLayeredPane.paint(Unknown Source)
	at javax.swing.JComponent.paintChildren(Unknown Source)
	at javax.swing.JComponent.paint(Unknown Source)
	at javax.swing.JComponent.paintToOffscreen(Unknown Source)
	at javax.swing.BufferStrategyPaintManager.paint(Unknown Source)
	at javax.swing.RepaintManager.paint(Unknown Source)
	at javax.swing.JComponent._paintImmediately(Unknown Source)
	at javax.swing.JComponent.paintImmediately(Unknown Source)
	at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
	at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
	at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
	at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.Dialog$1.run(Unknown Source)
	at java.awt.Dialog$3.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.awt.Dialog.show(Unknown Source)
	at javax.swing.JFileChooser.showDialog(Unknown Source)
	at javax.swing.JFileChooser.showOpenDialog(Unknown Source)
	at components.FileChooserDemo.actionPerformed(FileChooserDemo.java:102)
	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
	at java.awt.Component.processMouseEvent(Unknown Source)
	at javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)

or

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
	at javax.swing.plaf.basic.BasicListUI.updateLayoutState(Unknown Source)
	at javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState(Unknown Source)
	at javax.swing.plaf.basic.BasicListUI$Handler.valueChanged(Unknown Source)
	at javax.swing.DefaultListSelectionModel.fireValueChanged(Unknown Source)
	at javax.swing.DefaultListSelectionModel.fireValueChanged(Unknown Source)
	at javax.swing.DefaultListSelectionModel.fireValueChanged(Unknown Source)
	at javax.swing.DefaultListSelectionModel.moveLeadSelectionIndex(Unknown Source)
	at sun.swing.FilePane.clearSelection(Unknown Source)
	at sun.swing.FilePane$4.contentsChanged(Unknown Source)
	at javax.swing.AbstractListModel.fireContentsChanged(Unknown Source)
	at javax.swing.plaf.basic.BasicDirectoryModel.fireContentsChanged(Unknown Source)
	at javax.swing.plaf.basic.BasicDirectoryModel$DoChangeContents.run(Unknown Source)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)

REPRODUCIBILITY :
This bug can be reproduced often.

---------- BEGIN SOURCE ----------
[FileChooserDemo.java]
Please refer http://java.sun.com/docs/books/tutorial/uiswing/examples/components/index.html#FileChooserDemo

[FileChooserDemoApplet.java]
package components;

import javax.swing.JApplet;

public class FileChooserDemoApplet extends JApplet {
	private String[] dummy;

    public FileChooserDemoApplet() {
    }

    public void init() {
        FileChooserDemo.main(dummy);
    }
}

---------- END SOURCE ----------

Release Regression From : 6u3
The above release value was the last known release where this 
bug was not reproducible. Since then there has been a regression.

Comments
EVALUATION (copied from 6711589) In the BasicDirectoryModel class the SwingUtilities.invokeLater(...) method should be invoked from caller thread instead of COM-thread.
18-06-2008