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

JFileChooserOperator.enterSubDir does not navigate to sub directory

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 9, 10
    • client-libs

      JFileChooserOperator.enterSubDir does not navigate to sub directory and instead goes to user's default directory.

      The present code for JFileChooserOperator.enterSubDir(..) is

       public File enterSubDir(String dir, StringComparator comparator) {
              getQueueTool().waitEmpty();
              selectFile(dir, comparator);
              int index = findFileIndex(dir, comparator);
              waitPainted(index);
              setCurrentDirectory(getSelectedFile());
              return getCurrentDirectory();
          }

      This first selects the directory, then tries to navigate to the selected directory by getting the patch of selcted directory from getSelectedFile(),

      JFileChooserOperator.getSelectedFile() calls JFileChooser.getSelectedFile(), which returns the path for the selected file, but if the selection is a directory, then it returns Null.
      This when passed to setCurrentDirectory() sets the diectory as user's default directory.

            vagarwal Vikrant Agarwal
            vagarwal Vikrant Agarwal
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: