The method "showSaveDialog" of the JavaFX class "javafx.stage.FileChooser" throws undocumented exception "java.lang.IllegalArgumentException"
Oleksandr Yarmolenko
olexyarm at outlook.com
Sun Aug 17 17:44:33 UTC 2025
Hello,
I spent a few hours while debugging my JavaFX v.24 home application and
I'd like to share my finding.
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".
Thanks,
Alex
P.S. I pushed my test JavaFX application on GitHub
https://github.com/OlexYarm/JavaFx-test-FileChooser
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-discuss/attachments/20250817/f5c30f5a/attachment.htm>
More information about the openjfx-discuss
mailing list