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

JFileChooserOperator.enterSubDir does not navigate to sub directory

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 9, 10
    • Fix Version/s: 9
    • Component/s: client-libs
    • Labels:

      Description

      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.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: