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

FileChooser: Folder parameter must be a valid folder

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • jfx24
    • javafx
    • None

      From a user:

      In my application I accidentally set bad value in method "setInitialDirectory" of the JavaFX class "javafx.stage.FileChooser".

      First time my app was pointing on directory what does not exist. Another time it did it on nonexistent Windows drive.

      When it called method "showSaveDialog" it got exception "java.lang.IllegalArgumentException: Folder parameter must be a valid folder".

      The exception is not documented and does not say what parameter is incorrect and what is wrong with it.

      It would be nice to have the exception documented and it better say something like "setInitialDirectory parameter points on nonexistent folder or drive".

      Interesting that it didn't get exception while pointing on not accessible directory and "showSaveDialog" showed content of some other directory. For example with "setInitialDirectory" setting "C:\\Documents and Settings" it showed content of directory "C:\Users".

      Original reproducer: https://github.com/OlexYarm/JavaFx-test-FileChooser

            angorya Andy Goryachev
            angorya Andy Goryachev
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: