coobird / thumbnailator

Thumbnailator - a thumbnail generation library for Java
MIT License
5.08k stars 780 forks source link

identifier may not be blank #185

Closed bikerr closed 2 years ago

bikerr commented 2 years ago

An error is reported when I execute this code with the image

Thumbnails.of(src).scale(1.0).outputQuality(0.2).toFile(dst);
java.lang.IllegalArgumentException: identifier may not be blank
    at com.twelvemonkeys.lang.Validate.notEmpty(Validate.java:47)
    at com.twelvemonkeys.imageio.plugins.jpeg.Application.<init>(Application.java:54)
    at com.twelvemonkeys.imageio.plugins.jpeg.Application.read(Application.java:96)
    at com.twelvemonkeys.imageio.plugins.jpeg.Segment.read(Segment.java:94)
    at com.twelvemonkeys.imageio.plugins.jpeg.JPEGImageReader.initHeader(JPEGImageReader.java:721)
    at com.twelvemonkeys.imageio.plugins.jpeg.JPEGImageReader.getSOF(JPEGImageReader.java:784)
    at com.twelvemonkeys.imageio.plugins.jpeg.JPEGImageReader.getWidth(JPEGImageReader.java:244)
    at net.coobird.thumbnailator.tasks.io.InputStreamImageSource.readImage(Unknown Source)
    at net.coobird.thumbnailator.tasks.io.InputStreamImageSource.read(Unknown Source)
    at net.coobird.thumbnailator.tasks.io.FileImageSource.read(Unknown Source)
    at net.coobird.thumbnailator.tasks.SourceSinkThumbnailTask.read(Unknown Source)
    at net.coobird.thumbnailator.Thumbnailator.createThumbnail(Unknown Source)
    at net.coobird.thumbnailator.Thumbnails$Builder.toFile(Unknown Source)
coobird commented 2 years ago

@bikerr There's not enough information about your environment to reliably reproduce the issue.

Which version of Thumbnailator, TwelveMonkeys and Java are you using?

I've tried with 0.4.16, 3.8.1, 8 respectively, and have been unable to reproduce this using the image provided.

What are the types for src and dst? Are they String or File? What is the value for dst? Does it end with a "jpg" extension?

bikerr commented 2 years ago

@coobird
src and dst are both end with jpg File

The environment is :

thumbnailator:0.4.16
twelvemonkeys:3.3
java version "1.8.0_321"
coobird commented 2 years ago

@bikerr OK, I was able to reproduce it using TwelveMonkeys ImageIO 3.3.

This appears to be an issue with TwelveMonkeys ImageIO library rather than Thumbnailator.

In fact, seems like this behavior is not triggered in TwelveMonkeys ImageIO 3.4, so maybe you should consider updating your dependencies, if possible. (As I mentioned earlier, the latest version 3.8.1 also didn't exhibit this behavior.)

I'm closing this issue as it's not an issue with Thumbnailator.