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

JFileChooser uses ShellFolder instead of File from FileSystemView

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 6, 6u4
    • client-libs
    • generic, x86
    • windows_xp

      FULL PRODUCT VERSION :
      java version "1.6.0_05"
      Java(TM) SE Runtime Environment (build 1.6.0_05-b13)
      Java HotSpot(TM) Client VM (build 10.0-b19, mixed mode, sharing)

      The problem is present since the version 1.6.0_04.

      There was a similar bug, 4493369, in release 1.4.0-beta.

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      The application I work on implements its own version of FileSystemView and File to provide access to a remote filesystem. However, JFileChooser calls ShellFolder methods. In effect, I cannot open subdirectories on the remote filesystem.

      The following is a stack trace created after clicking the "Open" button:

      at client.tools.HttpFileChooser$HttpFile.getCanonicalFile(HttpFileChooser.java:417)
      at sun.awt.shell.ShellFolder.getNormalizedFile(ShellFolder.java:242)
      at javax.swing.plaf.basic.BasicFileChooserUI$Handler.mouseClicked(BasicFileChooserUI.java:423)
      at sun.swing.FilePane$Handler.mouseClicked(FilePane.java:1710)
      at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:253)
      at java.awt.Component.processMouseEvent(Component.java:6102)
      at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
      at java.awt.Component.processEvent(Component.java:5864)
      at java.awt.Container.processEvent(Container.java:2058)
      at java.awt.Component.dispatchEventImpl(Component.java:4466)
      at java.awt.Container.dispatchEventImpl(Container.java:2116)
      at java.awt.Component.dispatchEvent(Component.java:4296)
      at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
      at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3995)
      at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
      at java.awt.Container.dispatchEventImpl(Container.java:2102)
      at java.awt.Window.dispatchEventImpl(Window.java:2454)
      at java.awt.Component.dispatchEvent(Component.java:4296)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:284)
      at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

      As I checked in OpenJDK, ShellFolder.getNormalizedFile method creates its own instance of File class.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Create inherited versions of FileSystemView and File classes to access any remote or virtual filesystem.
      2. Instantiate JFileChooser with the newly created, custom FileSystemView.
      3. Try to open a subdirectory.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The subdirectory contents should be listed.
      ACTUAL -
      Nothing happens.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      CUSTOMER SUBMITTED WORKAROUND :
      Implement own JFileChooser alternative.

            rupashka Pavel Porvatov (Inactive)
            igor Igor Nekrestyanov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: