Code Monkey home page Code Monkey logo

Comments (7)

TheFifthRider avatar TheFifthRider commented on May 18, 2024

Not to resurrect an ancient github issue, but I did just reproduce this on my machine.
Stack trace:

java.lang.ArrayIndexOutOfBoundsException: 3834560
        at com.sun.javafx.image.impl.IntArgb$ToByteBgraPreConv.doConvert(IntArgb                                                                                  .java:216) ~[jfxrt.jar:?]
        at com.sun.javafx.image.impl.BaseIntToByteConverter.convert(BaseIntToByt                                                                                  eConverter.java:148) ~[jfxrt.jar:?]
        at com.sun.prism.Image$ByteAccess.setPixels(Image.java:1073) ~[jfxrt.jar                                                                                  :?]
        at com.sun.prism.Image.setPixels(Image.java:705) ~[jfxrt.jar:?]
        at javafx.scene.image.WritableImage$2.setPixels(WritableImage.java:219)                                                                                   ~[jfxrt.jar:?]
        at net.rptools.tokentool.util.ImageUtil.resizeCanvas(ImageUtil.java:173)                                                                                   ~[tokentool-2.0.jar:2.0]
        at net.rptools.tokentool.util.ImageUtil.getImage(ImageUtil.java:126) ~[t                                                                                  okentool-2.0.jar:2.0]
        at net.rptools.tokentool.util.ImageUtil.getOverlayThumb(ImageUtil.java:5                                                                                  8) ~[tokentool-2.0.jar:2.0]
        at net.rptools.tokentool.client.TokenTool.cacheOverlays(TokenTool.java:1                                                                                  99) ~[tokentool-2.0.jar:2.0]
        at net.rptools.tokentool.client.TokenTool.cacheOverlays(TokenTool.java:1                                                                                  96) ~[tokentool-2.0.jar:2.0]
        at net.rptools.tokentool.client.TokenTool.init(TokenTool.java:89) ~[toke                                                                                  ntool-2.0.jar:2.0]
        at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherIm                                                                                  pl.java:841) ~[jfxrt.jar:?]
        at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$154(                                                                                  LauncherImpl.java:182) ~[jfxrt.jar:?]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_162]

Investigating the offending image file, I discovered that one of the layers had an image that extended off the canvas. By cropping that layer to the canvas size, I was able to resolve the issue.

from tokentool.

Phergus avatar Phergus commented on May 18, 2024

Thanks for the report. If you still have the offending file and can attach it that would help when trying to fix it so it doesn't happen again.

from tokentool.

Azhrei avatar Azhrei commented on May 18, 2024

Given that stack trace, the best we'll be able to do is catch the exception and (perhaps) interpret it as an "invalid" image. The question will be where to put it; looking at just the method names, I'm guessing the getImage() method. (And it may be appropriate to try the image in MapTool and see if it bombs as well.)

from tokentool.

TheFifthRider avatar TheFifthRider commented on May 18, 2024

Sure, I fixed the offending file but it was pretty easy to just make a new one. Attached is an image that should allow you to reproduce the exception.
Error_Translucent.zip

from tokentool.

Phergus avatar Phergus commented on May 18, 2024

With TT 2.2.0 bad PSD (from GIMP) files no longer produce the crash. If you don't explicitly set each Layer to the Image Size in GIMP, when you export to PSD the file is unreadable by TT. It also appears incorrect in IrfanView.

image

from tokentool.

Phergus avatar Phergus commented on May 18, 2024

Testing with 2.2 develop under Java 16. Bad images don't cause a crash, the overlay is rejected and an exception is logged. Could still use some feedback to the user as well as catching the exception.

from tokentool.

Phergus avatar Phergus commented on May 18, 2024

Removed from 2.2 release. Leaving open for improvements to handling.

from tokentool.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.