WindowPositionManager does not resolve screen positions correctly
From time to time this error (see stack trace below) pops-out and prevents the application from starting. This is caused by having a negative value as 'windowProperties.x' (see example below). Replacing it with '0.0' allows the application to run again.
Stacktrace
22:00:30.915 [JavaFX Application Thread] INFO c.d.j.JsonSchemaEditor - Starting the application 22:00:31.883 [JavaFX Application Thread] DEBUG c.d.j.u.WindowPositionManager - Screens: [javafx.stage.Screen@be153540 bounds:Rectangle2D [minX = 0.0, minY=0.0, maxX=3840.0, maxY=2160.0, width=3840.0, height=2160.0] visualBounds:Rectangle2D [minX = 0.0, minY=0.0, maxX=3840.0, maxY=2110.0, width=3840.0, height=2110.0] dpi:-1.0 renderScale:1.0, javafx.stage.Screen@6a66d5c5 bounds:Rectangle2D [minX = 3840.0, minY=0.0, maxX=7680.0, maxY=2160.0, width=3840.0, height=2160.0] visualBounds:Rectangle2D [minX = 3840.0, minY=0.0, maxX=7680.0, maxY=2110.0, width=3840.0, height=2110.0] dpi:-1.0 renderScale:1.0] Exception in Application start method 22:00:31.893 [JavaFX Application Thread] INFO c.d.j.JsonSchemaEditor - Stopping the application Exception in thread "main" java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at sun.launcher.LauncherHelperFXHelper.main(LauncherHelper.java:767) Caused by: java.lang.RuntimeException: Exception in Application start method at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917) at com.sun.javafx.application.LauncherImpl.lambdalaunchApplication1(LauncherImpl.java:182) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.IllegalStateException: No screen found for x=[-8.0] at com.daslernen.jsonschemaeditor.ui.WindowPositionManager.lambdagetY3(WindowPositionManager.java:56) at java.util.Optional.orElseThrow(Optional.java:290) at com.daslernen.jsonschemaeditor.ui.WindowPositionManager.getY(WindowPositionManager.java:56) at com.daslernen.jsonschemaeditor.ui.WindowPositionManager.configure(WindowPositionManager.java:34) at com.daslernen.jsonschemaeditor.ui.StageInitialiser.init(StageInitialiser.java:27) at com.daslernen.jsonschemaeditor.JsonSchemaEditor.start(JsonSchemaEditor.java:33) at com.sun.javafx.application.LauncherImpl.lambdalaunchApplication18(LauncherImpl.java:863) at com.sun.javafx.application.PlatformImpl.lambdarunAndWait7(PlatformImpl.java:326) at com.sun.javafx.application.PlatformImpl.lambdanull5(PlatformImpl.java:295) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.application.PlatformImpl.lambdarunLater6(PlatformImpl.java:294) at com.sun.glass.ui.InvokeLaterDispatcherFuture.run(InvokeLaterDispatcher.java:95) at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method) at com.sun.glass.ui.gtk.GtkApplication.lambda$null$5(GtkApplication.java:139) ... 1 more
editor.conf example
{
"windowProperties" : {
"x" : -8.0,
"y" : 1107.0,
"width" : 1239.0,
"height" : 961.0,
"scale" : 150.0
},
... // other stuff
}