-
Bug
-
Resolution: Unresolved
-
P4
-
6u10, 6u16
-
x86
-
windows_xp
FULL PRODUCT VERSION :
java version "1.6.0_13"
Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
Java HotSpot(TM) Client VM (build 11.3-b02, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
As per the documentation:
"Used by UI classes to decide whether to display a special icon for a computer node, e.g. "My Computer" or a network server. The default implementation has no way of knowing, so always returns false."
... isComputerNode is broken and is therefore useless.
There seems to be no good way to enumerate the fixed disks in a computer
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Call isComputerNode on the "My Computer" node.
Call isDrive on the "C:\" node.
etc...
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package filesystemtest;
import java.io.File;
import javax.swing.filechooser.FileSystemView;
public class Main {
public static void main(String[] args) {
FileSystemView fsv = FileSystemView.getFileSystemView();
File [] roots = fsv.getRoots();
String os = System.getProperty("os.name");
if (os.startsWith("Windows")) {
// "Desktop" is the one root on Windows - so lets look inside
// My goal is to get a list of hard drives...
roots = fsv.getFiles(roots[0], true);
File r = roots[0];
System.err.println(fsv.getSystemDisplayName(r)
+ (fsv.isComputerNode(r)? " is" : " is NOT" )
+ " the Computer Node.");
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Assume that the nodes are returned in a known order (first and only root on Windows is "Desktop" - first child of it is "My Computer")
java version "1.6.0_13"
Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
Java HotSpot(TM) Client VM (build 11.3-b02, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
As per the documentation:
"Used by UI classes to decide whether to display a special icon for a computer node, e.g. "My Computer" or a network server. The default implementation has no way of knowing, so always returns false."
... isComputerNode is broken and is therefore useless.
There seems to be no good way to enumerate the fixed disks in a computer
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Call isComputerNode on the "My Computer" node.
Call isDrive on the "C:\" node.
etc...
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package filesystemtest;
import java.io.File;
import javax.swing.filechooser.FileSystemView;
public class Main {
public static void main(String[] args) {
FileSystemView fsv = FileSystemView.getFileSystemView();
File [] roots = fsv.getRoots();
String os = System.getProperty("os.name");
if (os.startsWith("Windows")) {
// "Desktop" is the one root on Windows - so lets look inside
// My goal is to get a list of hard drives...
roots = fsv.getFiles(roots[0], true);
File r = roots[0];
System.err.println(fsv.getSystemDisplayName(r)
+ (fsv.isComputerNode(r)? " is" : " is NOT" )
+ " the Computer Node.");
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Assume that the nodes are returned in a known order (first and only root on Windows is "Desktop" - first child of it is "My Computer")
- duplicates
-
JDK-6893621 Bugs in isDrive() & isComputerNode() of javax.swing.filechooser.FileSystemView
-
- Closed
-