-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
1.4.2
-
x86
-
windows_2000
Name: rmT116609 Date: 03/08/2004
FULL PRODUCT VERSION :
java version "1.5.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b32c)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b32c, mixed mode)
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows 2000 [Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
InternalError is thrown when calling File.listFiles() on a non directory file
When the File is both a shell File and a non directory file then anInternal Error is thrown.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Adapt the files indexes in the code such that file ends up being a non directory file on the test system.
Run code.
Observe error.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Not a Directory to be displayed.
ACTUAL -
InternalError
ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.lang.InternalError: Unable to bind C:\test.txt to parent
at sun.awt.shell.Win32ShellFolder2.getIShellFolder(Win32ShellFolder2.java:321)
at sun.awt.shell.Win32ShellFolder2.listFiles(Win32ShellFolder2.java:508)
at sun.awt.shell.ShellFolder.listFiles(ShellFolder.java:100)
at Test.main(Test.java:10)
Exception in thread "main"
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.*;
import java.util.*;
import javax.swing.filechooser.*;
public class Test {
public static void main(String[] args) {
FileSystemView fsv = FileSystemView.getFileSystemView();
File file = fsv.getHomeDirectory();
file = file.listFiles()[0].listFiles()[1].listFiles()[7];
File[] files = file.listFiles();
System.out.println(files == null ? "Not a Directory" : Arrays.asList(files).toString());
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
check if file is a directory before calling file.listFiles()
(Incident Review ID: 241381)
======================================================================
FULL PRODUCT VERSION :
java version "1.5.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b32c)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b32c, mixed mode)
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows 2000 [Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
InternalError is thrown when calling File.listFiles() on a non directory file
When the File is both a shell File and a non directory file then anInternal Error is thrown.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Adapt the files indexes in the code such that file ends up being a non directory file on the test system.
Run code.
Observe error.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Not a Directory to be displayed.
ACTUAL -
InternalError
ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.lang.InternalError: Unable to bind C:\test.txt to parent
at sun.awt.shell.Win32ShellFolder2.getIShellFolder(Win32ShellFolder2.java:321)
at sun.awt.shell.Win32ShellFolder2.listFiles(Win32ShellFolder2.java:508)
at sun.awt.shell.ShellFolder.listFiles(ShellFolder.java:100)
at Test.main(Test.java:10)
Exception in thread "main"
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.*;
import java.util.*;
import javax.swing.filechooser.*;
public class Test {
public static void main(String[] args) {
FileSystemView fsv = FileSystemView.getFileSystemView();
File file = fsv.getHomeDirectory();
file = file.listFiles()[0].listFiles()[1].listFiles()[7];
File[] files = file.listFiles();
System.out.println(files == null ? "Not a Directory" : Arrays.asList(files).toString());
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
check if file is a directory before calling file.listFiles()
(Incident Review ID: 241381)
======================================================================
- relates to
-
JDK-5055740 REGRESSION: JFileChooser: pif files show up as dirs and cause InternalError
- Resolved