JDK-4652211 : REGRESSION: JFileChooser is slow in listing directory contents
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.1.6,1.4.0
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_nt,windows_2000
  • CPU: x86
  • Submitted: 2002-03-13
  • Updated: 2002-06-16
  • Resolved: 2002-04-27
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.
Other
1.4.1 hopperFixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Description

Name: jk109818			Date: 03/13/2002


FULL PRODUCT VERSION :
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)

FULL OPERATING SYSTEM VERSION :

Microsoft Windows 2000 [Version 5.00.2195]

EXTRA RELEVANT SYSTEM CONFIGURATION :
Pentium III 1 GHz with 512 MB of RAM

A DESCRIPTION OF THE PROBLEM :
When using JFileChooser to browse directories with a large
number of files it takes a long time to load the directory.
Also by a large number of files I mean >50 which really
isn't that many there is a noticeable delay. The more files
the longer it takes.

I know it was not this slow with 1.3.1 so it is something
with 1.4. Also, if I just do a dir.list() (dir is a File
object that is a directory) and put these in a JList it is
not slow regardless of the layout orientation of the list.

I am trying to access them on a local hard drive not
networked. Furthermore I have a fairly fast machine
considering the your documentation shows a pentium 166 with
32 MB of RAM.

REGRESSION.  Last worked in version 1.3.1

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Get JFileChooser
2. Goto directory with >50 files has noticeable delay

EXPECTED VERSUS ACTUAL BEHAVIOR :
Expected: when double clicking on directory in JFileChooser
the list of files for that directory should appear
instantly provided there are a reasonable number of files
(< 1000 say) in the directory.

Actual: there is a noticeable delay when there are > 50
files in the directory

This bug can be reproduced always.

---------- BEGIN SOURCE ----------
/**
 * Should see noticeable delay to show the list of files when
 * you open try to view the contents of a directory with a large
 * number of files.
 */

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class FileChooserTest extends JFrame
{
  public FileChooserTest()
  {
    super("FileChooserTest");
    getContentPane().add(new JFileChooser(), BorderLayout.CENTER);
    pack();

    addWindowListener(new WindowAdapter()
    {
      public void actionPerformed(ActionEvent e)
      {
        dispose();
        System.exit(0);
      }
    });
  }

  public static void main(String[] args)
  {
    FileChooserTest test=new FileChooserTest();
    test.show();
  }
}
---------- END SOURCE ----------

CUSTOMER WORKAROUND :
Use 1.3.1 or write my own FileChooser

Release Regression From : 1.3.1
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: 144113) 
======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: hopper FIXED IN: hopper INTEGRATED IN: hopper VERIFIED IN: hopper-beta
14-06-2004

EVALUATION There were too many calls to native shell folder code to get file information and attributes. Values are now cached in Win32ShellFolder objects. Some values are initialized in the constructor, and some are cached more lazily (such as icons). Also, file listing threads in BasicDirectoryModel were not interrupted very well, boggin down the process even more. ###@###.### 2002-04-10
10-04-2002