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

Bugs in isDrive() & isComputerNode() of javax.swing.filechooser.FileSystemView

    Details

      Description

      FULL PRODUCT VERSION :
      jdk6 version 16

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP Professional Version 2002 Service Pack 3, 32bit English

      A DESCRIPTION OF THE PROBLEM :
      javax.swing.filechooser.FileSystemView's isDrive() function is bugged. Returns always true for all computerChildren's children even they are not a drive such as "My Documents" folder etc.

      javax.swing.filechooser.FileSystemView's isComputerNode() function is bugged. Returns always false, even the node is "My Computer" node.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.io.File;
      import javax.swing.filechooser.FileSystemView;

      public class Test {

          public static void main(String[] args) {
              
              FileSystemView systemView = FileSystemView.getFileSystemView();
              File desktop[] = systemView.getRoots();
              File desktopFiles[] = desktop[0].listFiles();
              
              File computerNode = desktopFiles[0]; // Windows XP's my computer node

              if (systemView.isComputerNode(computerNode)) {
                  //isComputer is bugged. Returns always false.
                  System.out.println("It says this IS 'My Computer' node: " + computerNode.getPath());
              }else {
                  System.out.println("It says this IS NOT 'My Computer' node: " + computerNode.getPath());
                  //::{20D04FE0-3AEA-1069-A2D8-08002B30309D} copy the path see what happens in Windows Explorer
              }
                 
              File computerChildren[] = computerNode.listFiles();

              for (int i = 0; i < computerChildren.length; i++) {
                  // isDrive is bugged. Returns always true for computerChildren's children
                  if (systemView.isDrive(computerChildren[i])) {
                      System.err.println(computerChildren[i] + " is a drive? 'YES' it says");
                  } else {
                      System.err.println(computerChildren[i] + " is a drive? 'NO' it says");
                  }
              }

          }
      }
      ---------- END SOURCE ----------

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                rupashka Pavel Porvatov (Inactive)
                Reporter:
                ndcosta Nelson Dcosta (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: