saalfeldlab / paintera

GNU General Public License v2.0
100 stars 17 forks source link

Cannot create/open project on Windows #331

Closed igorpisarev closed 5 years ago

igorpisarev commented 5 years ago

Trying to run 0.20.0 on Windows without any cmd arguments. The project selection dialog appears, but after selecting "No project" or "Specify project" and giving it an existing directory, the following error occurs:

C:\>paintera
Exception in Application start method
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
        at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at sun.launcher.LauncherHelper$FXHelper.main(Unknown Source)
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.lambda$launchApplication$1(LauncherImpl.java:182)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ExceptionInInitializerError
        at org.janelia.saalfeldlab.paintera.config.input.KeyAndMouseConfig.<init>(KeyAndMouseConfig.kt:12)
        at org.janelia.saalfeldlab.paintera.Paintera.startImpl(Paintera.java:156)
        at org.janelia.saalfeldlab.paintera.Paintera.start(Paintera.java:88)
        at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$8(LauncherImpl.java:863)
        at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$7(PlatformImpl.java:326)
        at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294)
        at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
        at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
        at com.sun.glass.ui.win.WinApplication.lambda$null$3(WinApplication.java:177)
        ... 1 more
Caused by: java.util.regex.PatternSyntaxException: Illegal/unsupported escape sequence near index 4
^C:\Users\username
    ^
        at java.util.regex.Pattern.error(Unknown Source)
        at java.util.regex.Pattern.escape(Unknown Source)
        at java.util.regex.Pattern.atom(Unknown Source)
        at java.util.regex.Pattern.sequence(Unknown Source)
        at java.util.regex.Pattern.expr(Unknown Source)
        at java.util.regex.Pattern.compile(Unknown Source)
        at java.util.regex.Pattern.<init>(Unknown Source)
        at java.util.regex.Pattern.compile(Unknown Source)
        at kotlin.text.Regex.<init>(Regex.kt:89)
        at org.janelia.saalfeldlab.paintera.PainteraMainWindow.<clinit>(PainteraMainWindow.kt:351)
        ... 12 more

The lock file is created as usual, and if restarting the application with the same project directory, it detects the lock file asks to remove it. After that, the above error occurs again.

hanslovsky commented 5 years ago

I'll have a look @igorpisarev

hanslovsky commented 5 years ago

Please try with the fix-331 branch @igorpisarev

The culprit was System.getProperty("user.home").toRegex() because "user.home" contains backslashes on Windows. This should fix it.

Thanks

hanslovsky commented 5 years ago

I also just botted into Windows on my laptop, let's see what I can do.

igorpisarev commented 5 years ago

Thanks @hanslovsky, I can try it next week (it's on somebody else's machine)

hanslovsky commented 5 years ago

I just tested on my laptop:

  1. confirmed that 0.20.0 does not work.
  2. confirmed that, with the fix, I can create a project and load data.

However, I was unable to save the project, some gson serializers don't seem to be discovered.

hanslovsky commented 5 years ago

This seems to be specific to Paintera2 that uses PainteraMainWindow, for which the serializer cannot be discovered.

hanslovsky commented 5 years ago

It is possible that annotated Kotlin Serializers/Adapters are not being discovered.

hanslovsky commented 5 years ago

I will go ahead and merge and open another issue for the Serializers/Adapters cf https://forum.image.sc/t/plugins-annotations-are-not-added-to-index-in-jar-file-if-implemented-in-kotlin-in-src-main-java-source-tree/29700