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

FileSystemView getParentDirectory() crashes for file "."

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.4.2
    • client-libs



      Name: js151677 Date: 09/22/2004


      FULL PRODUCT VERSION :
      1.4.2_05

      ADDITIONAL OS VERSION INFORMATION :
      4NT 3,01A Windows NT 5,01, Window XP

      A DESCRIPTION OF THE PROBLEM :
      When you obtain a FileSystemView instance by calling FileSystemView.getFileSystemView(), this instance will crash for a call to getParentDirectory(new File(".")) by writing stack traces to sys-err.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the source code provided below.

      ACTUAL -
      java.version = 1.4.2_05
      os.name = Windows XP
      os.version = 5.1
      file = C:\PaderDMirror\Daten\eclipse\workspace\Labor\.
      file.exists() = true
      FileSystemView.getShellFolder: f=.
      java.io.FileNotFoundException: Could not find file C:\PaderDMirror\Daten\eclipse\workspace\Labor\.
      at sun.awt.shell.Win32ShellFolder2.parseDisplayName(Win32ShellFolder2.java:580)
      at sun.awt.shell.Win32ShellFolderManager2.createShellFolder(Win32ShellFolderManager2.java:40)
      at sun.awt.shell.Win32ShellFolderManager2.createShellFolder(Win32ShellFolderManager2.java:36)
      at sun.awt.shell.ShellFolder.getShellFolder(ShellFolder.java:236)
      at javax.swing.filechooser.FileSystemView.getShellFolder(FileSystemView.java:486)
      at javax.swing.filechooser.FileSystemView.getParentDirectory(FileSystemView.java:456)
      at fileSystemViewBug.FileSystemViewBugMain.main(FileSystemViewBugMain.java:49)
      java.lang.NullPointerException
      at javax.swing.filechooser.FileSystemView.getParentDirectory(FileSystemView.java:457)
      at fileSystemViewBug.FileSystemViewBugMain.main(FileSystemViewBugMain.java:49)
      Exception in thread "main"

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
              // infos
              System.out.println("java.version = " + System.getProperty("java.version"));
              System.out.println("os.name = " + System.getProperty("os.name"));
              System.out.println("os.version = " + System.getProperty("os.version"));
              
              // create/get instances
              FileSystemView fsv = FileSystemView.getFileSystemView();
              File someFile = new File(".");
              
              // log
              System.out.println("file = " + someFile.getAbsolutePath());
              System.out.println("file.exists() = " + someFile.exists());
              
              // use FileSystemView to get parent
              File parentFile = fsv.getParentDirectory(someFile);

      ---------- END SOURCE ----------
      (Incident Review ID: 311468)
      ======================================================================

            leifs Leif Samuelsson (Inactive)
            jssunw Jitender S (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: