< prev index next >

src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java

Print this page
rev 48355 : Fixed 8194044: Regression  manual Test javax/swing/JFileChooser/8067660/FileChooserTest.java fails
Added a test case as well for the fix.
Incorporated changes suggested by Jay.


 431             return true;
 432         } else {
 433             String path = AccessController.doPrivileged(new PrivilegedAction<String>() {
 434                 public String run() {
 435                     return dir.getAbsolutePath();
 436                 }
 437             });
 438 
 439             return (path.startsWith("\\\\") && path.indexOf("\\", 2) < 0);      //Network path
 440         }
 441     }
 442 
 443     public boolean isFileSystemRoot(File dir) {
 444         //Note: Removable drives don't "exist" but are listed in "My Computer"
 445         if (dir != null) {
 446 
 447             if (dir instanceof Win32ShellFolder2) {
 448                 Win32ShellFolder2 sf = (Win32ShellFolder2)dir;
 449 
 450                 return (sf.isFileSystem() && sf.parent != null &&
 451                         sf.parent.equals(Win32ShellFolder2.listRoots()));
 452             }
 453             String path = dir.getPath();
 454 
 455             if (path.length() != 3 || path.charAt(1) != ':') {
 456                 return false;
 457             }
 458 
 459             File[] roots = Win32ShellFolder2.listRoots();
 460 
 461             return roots != null && Arrays.asList(roots).contains(dir);
 462         }
 463         return false;
 464     }
 465 
 466     private static List<Win32ShellFolder2> topFolderList = null;
 467     static int compareShellFolders(Win32ShellFolder2 sf1, Win32ShellFolder2 sf2) {
 468         boolean special1 = sf1.isSpecial();
 469         boolean special2 = sf2.isSpecial();
 470 
 471         if (special1 || special2) {




 431             return true;
 432         } else {
 433             String path = AccessController.doPrivileged(new PrivilegedAction<String>() {
 434                 public String run() {
 435                     return dir.getAbsolutePath();
 436                 }
 437             });
 438 
 439             return (path.startsWith("\\\\") && path.indexOf("\\", 2) < 0);      //Network path
 440         }
 441     }
 442 
 443     public boolean isFileSystemRoot(File dir) {
 444         //Note: Removable drives don't "exist" but are listed in "My Computer"
 445         if (dir != null) {
 446 
 447             if (dir instanceof Win32ShellFolder2) {
 448                 Win32ShellFolder2 sf = (Win32ShellFolder2)dir;
 449 
 450                 return (sf.isFileSystem() && sf.parent != null &&
 451                         sf.parent.equals(getDrives()));
 452             }
 453             String path = dir.getPath();
 454 
 455             if (path.length() != 3 || path.charAt(1) != ':') {
 456                 return false;
 457             }
 458 
 459             File[] roots = Win32ShellFolder2.listRoots();
 460 
 461             return roots != null && Arrays.asList(roots).contains(dir);
 462         }
 463         return false;
 464     }
 465 
 466     private static List<Win32ShellFolder2> topFolderList = null;
 467     static int compareShellFolders(Win32ShellFolder2 sf1, Win32ShellFolder2 sf2) {
 468         boolean special1 = sf1.isSpecial();
 469         boolean special2 = sf2.isSpecial();
 470 
 471         if (special1 || special2) {


< prev index next >