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

Methods createFileSystemRoot and isFileSystemRoot works incorrect

XMLWordPrintable



      Name: dsR10051 Date: 05/30/2001



      The behavior of methods
      File javax.swing.filechooser.FileSystemView.createFileSystemRoot(File f)
      and public boolean isFileSystemRoot(File dir) do not match each others.
      Under Windows platform createFileSystemRoot method returns file
      for which isFileSystemRoot returns false.

      Here is minimized test:

      import javax.swing.filechooser.*;
      import java.io.*;

      public class FileSystemViewTest02 {
          public static void main(String[] args) {
              MyFileSystemView fsv = new MyFileSystemView();
      File file = new File("");
      File f = fsv.createFileSystemRoot(file);
              System.out.println(f);
              System.out.println(fsv.isFileSystemRoot(f));
          }
      }

      class MyFileSystemView extends FileSystemView {

          public File createNewFolder (File f) throws IOException {
      System.out.println("createNewFolder called");
      return null;
          }

          public File createFileSystemRoot(File f) {
      return super.createFileSystemRoot(f);
          }
      }

      --- Output ---

      C:\user\sda\bin>set CLASSPATH=.

      C:\user\sda\bin>N:\JDK1.4.0beta-b65\win32\bin\java FileSystemViewTest02
      false

      ======================================================================

            leifs Leif Samuelsson (Inactive)
            sdasunw Sda Sda (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: