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

Fails to start with missing image on arch #218

Open
BlueDrink9 opened this issue Aug 29, 2021 · 10 comments
Open

Fails to start with missing image on arch #218

BlueDrink9 opened this issue Aug 29, 2021 · 10 comments

Comments

@BlueDrink9
Copy link

BlueDrink9 commented Aug 29, 2021

Describe the bug
Fails to start with missing image

I imagine this is an issue with installation on arch, so I'd appreciate help manually fixing it (and I'll share results with the package maintainer)

To Reproduce
start app, which fails

TokenTool Info

  • Version: 2.2.1
  • Install: New

Desktop (please complete the following information):

  • OS: Arch
  • Version latest

Additional context

Installed from AUR, with a modified pkgbuild to get the latest version installed.

Debug log:

2021-08-30 10:51:41,489 JavaFX-Launcher ERROR Appenders contains an invalid element or attribute "Sentry"
2021-08-30 10:51:41,513 JavaFX-Launcher ERROR Unable to locate appender "Sentry"for logger config "root"
10:51:41.608 (null:-1) [JavaFX-Launcher] INFO  - Overlays installed: 183
10:51:41.665 (null:-1) [JavaFX-Launcher] INFO  - Environment: Production
10:51:41.666 (null:-1) [JavaFX-Launcher] INFO  - Sentry DSN: https://312e480e6390426095b0a66a11f343a9@sentry.io/1406000
10:51:41.666 (null:-1) [JavaFX-Launcher] INFO  - Vendor: rptools
10:51:41.667 (null:-1) [JavaFX-Launcher] INFO  - Release: 2.2.1
10:51:41.667 (null:-1) [JavaFX-Launcher] INFO  - OS: Linux
10:51:41.668 (null:-1) [JavaFX-Launcher] INFO  - 3D Hardware Available? true
10:51:41.681 (null:-1) [JavaFX-Launcher] DEBUG - caching /home/user/.tokentool-rptools/overlays
10:51:41.682 (null:-1) [JavaFX-Launcher] DEBUG - caching /home/user/.tokentool-rptools/overlays/Square
10:51:42.180 (null:-1) [JavaFX-Launcher] DEBUG - caching /home/user/.tokentool-rptools/overlays/Round
10:51:42.181 (null:-1) [JavaFX-Launcher] DEBUG - caching /home/user/.tokentool-rptools/overlays/Round/Decorated
10:51:43.914 (null:-1) [JavaFX-Launcher] DEBUG - caching /home/user/.tokentool-rptools/overlays/Round/Smooth
10:51:46.768 (null:-1) [JavaFX-Launcher] DEBUG - caching /home/user/.tokentool-rptools/overlays/Round/Gears
10:51:46.950 (null:-1) [JavaFX-Launcher] DEBUG - caching /home/user/.tokentool-rptools/overlays/Round/Chains
10:51:47.654 (null:-1) [JavaFX-Launcher] DEBUG - caching /home/user/.tokentool-rptools/overlays/Round/Runes
10:51:48.353 (null:-1) [JavaFX-Launcher] DEBUG - caching /home/user/.tokentool-rptools/overlays/Round/Bottlecaps
10:51:49.122 (null:-1) [JavaFX-Launcher] DEBUG - caching /home/user/.tokentool-rptools/overlays/Cards
Exception in Application init method
java.lang.reflect.InvocationTargetException
 at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.base/java.lang.reflect.Method.invoke(Unknown Source)
 at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(Unknown Source)
 at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(Unknown Source)
 at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.base/java.lang.reflect.Method.invoke(Unknown Source)
 at java.base/sun.launcher.LauncherHelper$FXHelper.main(Unknown Source)
Caused by: java.lang.RuntimeException: Exception in Application init method
 at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(Unknown Source)
 at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchA
pplication$2(Unknown Source)
 at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException: Image dimensions must be positive(w,h > 0)
 at javafx.graphics/javafx.scene.image.Image.<init>(Unknown Source)
 at javafx.graphics/javafx.scene.image.WritableImage.<init>(Unknown Source)
 at net.rptools.tokentool@2.2.1/net.rptools.tokentool.util.ImageUtil.processMagenta(Unknown Source)
 at net.rptools.tokentool@2.2.1/net.rptools.tokentool.util.ImageUtil.getImage(Unknown Source)
 at net.rptools.tokentool@2.2.1/net.rptools.tokentool.util.ImageUtil.getOverlayThumb(Unknown Source)
 at net.rptools.tokentool@2.2.1/net.rptools.tokentool.client.TokenTool.cacheOverlays(Unknown Source)
 at net.rptools.tokentool@2.2.1/net.rptools.tokentool.client.TokenTool.cacheOverlays(Unknown Source)
 at net.rptools.tokentool@2.2.1/net.rptools.tokentool.client.TokenTool.init(Unknown Source)
 ... 3 more
Exception running application net.rptools.tokentool.client.TokenTool
@Azhrei
Copy link
Member

Azhrei commented Aug 30, 2021

Based on this from your log (see the two bold sections), I'm guessing you've got an overlay under ~/.tokentool-rptools that is messed up (corrupted, or maybe an empty file, or something similar):

Caused by: java.lang.IllegalArgumentException: Image dimensions must be positive(w,h > 0)
at javafx.graphics/javafx.scene.image.Image.(Unknown Source)
at javafx.graphics/javafx.scene.image.WritableImage.(Unknown Source)
at net.rptools.tokentool@2.2.1/net.rptools.tokentool.util.ImageUtil.processMagenta(Unknown Source)
at net.rptools.tokentool@2.2.1/net.rptools.tokentool.util.ImageUtil.getImage(Unknown Source)
at net.rptools.tokentool@2.2.1/net.rptools.tokentool.util.ImageUtil.getOverlayThumb(Unknown Source)
at net.rptools.tokentool@2.2.1/net.rptools.tokentool.client.TokenTool.cacheOverlays(Unknown Source)

If you've executed TokenTool before (an older version of it, for example), then maybe some leftover image data is the problem. You can try looking under that directory, or just rename it to something else and see if TT starts up after that. (It will recreate the directory.) If it does, then you can go back to the old directory and copy over any custom overlays you might have created.

(Because the log specifically calls out getOverlayThumb, it may be that you can just delete the thumbnail directory and restarting TT will work.)

@BlueDrink9
Copy link
Author

BlueDrink9 commented Aug 30, 2021

I had installed an old entry (AUR was out of date, and I submitted a fix there).

However, removing the contents of that whole folder sadly doesn't help.

2021-08-30 17:59:23,512 JavaFX-Launcher ERROR Appenders contains an invalid element or attribute "Sentry"
2021-08-30 17:59:23,542 JavaFX-Launcher ERROR Unable to locate appender "Sentry" for logger config "root"
17:59:23.649 (null:-1) [JavaFX-Launcher] INFO  - Overlays installed: 183
17:59:23.715 (null:-1) [JavaFX-Launcher] INFO  - Environment: Production
17:59:23.716 (null:-1) [JavaFX-Launcher] INFO  - Sentry DSN: https://312e480e6390426095b0a66a11f343a9@sentry.io/1406000
17:59:23.716 (null:-1) [JavaFX-Launcher] INFO  - Vendor: rptools
17:59:23.717 (null:-1) [JavaFX-Launcher] INFO  - Release: 2.2.1
17:59:23.717 (null:-1) [JavaFX-Launcher] INFO  - OS: Linux
17:59:23.718 (null:-1) [JavaFX-Launcher] INFO  - 3D Hardware Available? true
17:59:23.728 (null:-1) [JavaFX-Launcher] DEBUG - caching /home/user/.tokentool-rptools/overlays
17:59:23.729 (null:-1) [JavaFX-Launcher] DEBUG - caching /home/user/.tokentool-rptools/overlays/Hex
17:59:24.278 (null:-1) [JavaFX-Launcher] DEBUG - caching /home/user/.tokentool-rptools/overlays/Square
17:59:24.662 (null:-1) [JavaFX-Launcher] DEBUG - caching /home/user/.tokentool-rptools/overlays/Round
17:59:24.664 (null:-1) [JavaFX-Launcher] DEBUG - caching /home/user/.tokentool-rptools/overlays/Round/Chains
17:59:25.378 (null:-1) [JavaFX-Launcher] DEBUG - caching /home/user/.tokentool-rptools/overlays/Round/Decorated
17:59:26.496 (null:-1) [JavaFX-Launcher] DEBUG - caching /home/user/.tokentool-rptools/overlays/Round/Runes
17:59:27.159 (null:-1) [JavaFX-Launcher] DEBUG - caching /home/user/.tokentool-rptools/overlays/Round/Bottlecaps
17:59:27.811 (null:-1) [JavaFX-Launcher] DEBUG - caching /home/user/.tokentool-rptools/overlays/Round/Smooth
17:59:30.037 (null:-1) [JavaFX-Launcher] DEBUG - caching /home/user/.tokentool-rptools/overlays/Round/Gears
17:59:30.174 (null:-1) [JavaFX-Launcher] DEBUG - caching /home/user/.tokentool-rptools/overlays/Create
17:59:30.237 (null:-1) [JavaFX-Launcher] DEBUG - caching /home/user/.tokentool-rptools/overlays/Cards
Exception in Application init method
java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(Unknown Source)
	at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(Unknown Source)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at java.base/sun.launcher.LauncherHelper$FXHelper.main(Unknown Source)
Caused by: java.lang.RuntimeException: Exception in Application init method
	at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(Unknown Source)
	at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException: Image dimensions must be positive (w,h > 0)
	at javafx.graphics/javafx.scene.image.Image.<init>(Unknown Source)
	at javafx.graphics/javafx.scene.image.WritableImage.<init>(Unknown Source)
	at net.rptools.tokentool@2.2.1/net.rptools.tokentool.util.ImageUtil.processMagenta(Unknown Source)
	at net.rptools.tokentool@2.2.1/net.rptools.tokentool.util.ImageUtil.getImage(Unknown Source)
	at net.rptools.tokentool@2.2.1/net.rptools.tokentool.util.ImageUtil.getOverlayThumb(Unknown Source)
	at net.rptools.tokentool@2.2.1/net.rptools.tokentool.client.TokenTool.cacheOverlays(Unknown Source)
	at net.rptools.tokentool@2.2.1/net.rptools.tokentool.client.TokenTool.cacheOverlays(Unknown Source)
	at net.rptools.tokentool@2.2.1/net.rptools.tokentool.client.TokenTool.init(Unknown Source)
	... 3 more
Exception running application net.rptools.tokentool.client.TokenTool

@BlueDrink9
Copy link
Author

All the images inside Cards seem fine

@Phergus
Copy link
Contributor

Phergus commented Aug 30, 2021

Caused by: java.lang.IllegalArgumentException: Image dimensions must be positive (w,h > 0)
	at javafx.graphics/javafx.scene.image.Image.<init>(Unknown Source)
	at javafx.graphics/javafx.scene.image.WritableImage.<init>(Unknown Source)
	at net.rptools.tokentool@2.2.1/net.rptools.tokentool.util.ImageUtil.processMagenta(Unknown Source)

processMagenta() is only used for the older PNG type overlays. You might try removing the Cards & Square folders temporarily and see if it is getting hung up on one of those. (I think those are the only ones left in PNG format.)

@BlueDrink9
Copy link
Author

I removed the whole ~/.tokentool-rptools folder, but tokentool is recreating it

@BlueDrink9
Copy link
Author

Oh! deleting just the card and square folder and restarting lets tokentool start!

@Azhrei
Copy link
Member

Azhrei commented Aug 30, 2021

I'm curious which file in particular was causing the problem, but most likely this is a bug in the platform library that Java uses to read PNG files. Otherwise, we'd have heard from other users about this same issue.

@SagittaryX
Copy link

SagittaryX commented Sep 11, 2021

Had this same problem while running Manjaro, it seems to be the presence of JPG files in the Cards folder that causes the crash, PNG images work just fine. Investigated the issue together with a friend who is more experienced with Linux. I ran the program from source files with a few edits to make it stop crashing, specifically adding a few lines in the processMagenta function of ImageUtil.java. This is of course not a fix, but with the lines in place the program builds and launches, the only issue then is that images in the Cards folder that are JPG do not load in (or rather, they load in as 1x1 broken images).

Also suspected it might have been an issue with openJDK in Linux, but got the issue when building the source code with the Oracle JDK.

private static Image processMagenta(Image inputImage, int colorThreshold, boolean overlayWanted) {
    int imageWidth = (int) inputImage.getWidth();
    int imageHeight = (int) inputImage.getHeight();

    if (imageWidth < 1) imageWidth = 1; #newline
    if (imageHeight < 1) imageHeight = 1; #newline
    
    WritableImage outputImage = new WritableImage(imageWidth, imageHeight);
    PixelReader pixelReader = inputImage.getPixelReader();
    PixelWriter pixelWriter = outputImage.getPixelWriter();
    
    if (pixelReader == null) return outputImage; #newline

    for (int readY = 0; readY < imageHeight; readY++) {
      for (int readX = 0; readX < imageWidth; readX++) {
        Color pixelColor = pixelReader.getColor(readX, readY);

        if (isMagenta(pixelColor, COLOR_THRESHOLD) == overlayWanted) {
          pixelWriter.setColor(readX, readY, Color.TRANSPARENT);
        } else {
          pixelWriter.setColor(readX, readY, pixelColor);
        }
      }
    }

    return outputImage;
  }

@SagittaryX
Copy link

SagittaryX commented Nov 1, 2021

I can now also confirm that the same issue exists when running Fedora 35 from the RPM version, and it's resolved by just removing all the JPG images from the Cards folder of the install.

@Phergus
Copy link
Contributor

Phergus commented Nov 1, 2021

@SagittaryX thanks for the follow up. We'll probably need to re-save them or maybe just replace them with webp versions.

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

4 participants