The method "showSaveDialog" of the JavaFX class "javafx.stage.FileChooser" throws undocumented exception "java.lang.IllegalArgumentException"
Andy Goryachev
andy.goryachev at oracle.com
Thu Aug 21 15:56:09 UTC 2025
Thank you Oleksandr!
Created this JBS ticket: https://bugs.openjdk.org/browse/JDK-8365938
-andy
From: openjfx-discuss <openjfx-discuss-retn at openjdk.org> on behalf of Oleksandr Yarmolenko <olexyarm at outlook.com>
Date: Sunday, August 17, 2025 at 10:44
To: openjfx-discuss at openjdk.org <openjfx-discuss at openjdk.org>
Subject: The method "showSaveDialog" of the JavaFX class "javafx.stage.FileChooser" throws undocumented exception "java.lang.IllegalArgumentException"
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/20250821/f6ea1624/attachment-0001.htm>
More information about the openjfx-discuss
mailing list