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

REGRESSION: JFileChooser is slow in listing directory contents

XMLWordPrintable

    • hopper
    • x86
    • windows_nt, windows_2000
    • Verified



      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)
      ======================================================================

            leifs Leif Samuelsson (Inactive)
            jkimsunw Jeffrey Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: