import com.dlsc.preferencesfx.PreferencesFx;
import com.dlsc.preferencesfx.model.Category;
import com.dlsc.preferencesfx.model.Setting;
import javafx.application.Application;
import javafx.beans.property.SimpleObjectProperty;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
public class TestApp extends Application {
public static void main(final String[] args) {
launch(args);
}
@Override
public void start(final Stage primaryStage) throws Exception {
PreferencesFx.of(TestApp.class,
Category.of("Painters")
.subCategories(Category.of(
"Selected Firs",
Setting.of("Color", new SimpleObjectProperty<>(Color.RED)),
Setting.of("Fill Color", new SimpleObjectProperty<>(Color.RED))
))
).show();
}
}
This simple demo will throw an IllegalArgumentException
Exception in Application start method
Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:900)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: java.lang.IllegalArgumentException: Key contains code point U+0000
at java.prefs/java.util.prefs.AbstractPreferences.get(AbstractPreferences.java:296)
at com.dlsc.preferencesfx.util.PreferencesBasedStorageHandler.getSerializedPreferencesValue(PreferencesBasedStorageHandler.java:302)
at com.dlsc.preferencesfx.util.PreferencesBasedStorageHandler.loadObject(PreferencesBasedStorageHandler.java:227)
at com.dlsc.preferencesfx.model.Setting.loadSettingValue(Setting.java:517)
at com.dlsc.preferencesfx.model.PreferencesFxModel.lambda$loadSettingValues$7(PreferencesFxModel.java:213)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at com.dlsc.preferencesfx.model.PreferencesFxModel.loadSettingValues(PreferencesFxModel.java:209)
at com.dlsc.preferencesfx.PreferencesFx.init(PreferencesFx.java:69)
at com.dlsc.preferencesfx.PreferencesFx.<init>(PreferencesFx.java:64)
at com.dlsc.preferencesfx.PreferencesFx.<init>(PreferencesFx.java:55)
at com.dlsc.preferencesfx.PreferencesFx.of(PreferencesFx.java:102)
at net.marvk.fs.vatsim.map.TestApp.start(TestApp.java:18)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
... 1 more
Process finished with exit code 1
The breadcrumb Painters#null#Fill Color is being passed to PreferencesBasedStorageHandler.deprecatedHash(String), which returns
��a�r�?��
�����c�y
y��Bc
The cause is the description Fill Color. Using, for example, Fill Colora, the PrefrencesFx window is being constructed without issue.
preferencesfx-core version: 11.6.0
javafx version 15.0.1
jdk: OpenJDK 15.0.1
Consider the following Application
This simple demo will throw an
IllegalArgumentException
The breadcrumb
Painters#null#Fill Color
is being passed toPreferencesBasedStorageHandler.deprecatedHash(String)
, which returnsThe cause is the description
Fill Color
. Using, for example,Fill Colora
, the PrefrencesFx window is being constructed without issue.preferencesfx-core version: 11.6.0 javafx version 15.0.1 jdk: OpenJDK 15.0.1