JDK-5105436 : FileSystemView getParentDirectory() crashes for file "."
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.2
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2004-09-22
  • Updated: 2004-09-23
  • Resolved: 2004-09-23
Related Reports
Duplicate :  
Description

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

Comments
EVALUATION Name: ad153231 Date: 09/22/2004 Seems to be an AWT bug. Reproducible from JDK1.4 but not with JDK1.3. Not a Tiger regression. Not reproducible on linux/solaris though. ====================================================================== Name: df153228 Date: 09/22/2004 This bug is reproducible with jdk1.5.0b55 and not reproducible with jdk1.5.0b62. ###@###.### ======================================================================
24-09-2004