Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-existent directories cannot be changed via UI #441

Open
ghost opened this issue Jan 2, 2023 · 0 comments
Open

Non-existent directories cannot be changed via UI #441

ghost opened this issue Jan 2, 2023 · 0 comments

Comments

@ghost
Copy link

ghost commented Jan 2, 2023

Description

When a user has deleted a directory that formerly existed as a preference, the PreferencesFX dialog prevents the user from choosing a different directory.

Replicate

Create a PreferencesFX controller with a file selection option, such as:

Preferences-000017

In the figure, the path c:\cygwin\home\Dave used to exist, but no longer exists.

Click Browse to change the directory.

Expected

The file picker dialog appears, allowing the user to choose a different directory. Since the initial directory doesn't exist, the default should be set to something reasonable (such as System.getProperty( "user.home" )).

Actual

No dialog appears.

Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: Folder parameter must be a valid folder
        at javafx.graphics/com.sun.glass.ui.CommonDialogs.convertFolder(Unknown Source)
        at javafx.graphics/com.sun.glass.ui.CommonDialogs.showFolderChooser(Unknown Source)
        at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.showDirectoryChooser(Unknown Source)
        at javafx.graphics/javafx.stage.DirectoryChooser.showDialog(Unknown Source)
        at com.dlsc.preferencesfx.formsfx.view.controls.SimpleChooserControl.lambda$initializeParts$0(SimpleChooserControl.java:143)

Full stack trace is attached.

preferences-fx.txt

Work around

Applications must first verify that each directory exists before allowing PreferencesFX to attempt to change it. This is a brittle work around because users may still delete directories while the application is running, which would require a watch dog on the entire system.

System

Using JDK 19 with JavaFX 19 on WIndows 10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants