You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TwelveMonkeys ImageIO works flawlessly with Ant when calling a class that uses it with the Java target and by setting the "fork" attribute to true. Otherwise, the SPIs are never loaded (it's not a bug):
java.lang.IllegalArgumentException: image == null!
at javax.imageio.ImageTypeSpecifier.createFromRenderedImage(ImageTypeSpecifier.java:925)
at javax.imageio.ImageIO.getWriter(ImageIO.java:1591)
at javax.imageio.ImageIO.write(ImageIO.java:1520)
Maybe another workaround consists in modifying the system classloader of Ant with ant-classloadertask but I haven't tested it yet. A less smart solution would consist in putting the necessary JARs directly inside Ant.
In my humble opinion, it should be mentioned in the documentation of this library. It's neither a limitation nor a bug, it's something that an Apache Ant user should know.
The text was updated successfully, but these errors were encountered:
I'm not an Apache Ant user myself, so I'm not really sure if this is something that needs to be covered in the documentation... From what I understand about the stack trace you see, It is a common ImageIO plugin thing, based on how the SPI mechanism work.
Adding ImageIO.scanForPlugins() somewhere in your code (or custom Ant target) should make the SPIs registered, even without the fork attribute.
Thank you for the trick, I should have read more carefully the Java documentation of the standard API. It's up to you to decide whether to put it into the documentation but I understand your objection and I confirm that this isn't specific to your library, it could have happened with any library based on the SPI mechanism.
TwelveMonkeys ImageIO works flawlessly with Ant when calling a class that uses it with the Java target and by setting the "fork" attribute to true. Otherwise, the SPIs are never loaded (it's not a bug):
Maybe another workaround consists in modifying the system classloader of Ant with ant-classloadertask but I haven't tested it yet. A less smart solution would consist in putting the necessary JARs directly inside Ant.
In my humble opinion, it should be mentioned in the documentation of this library. It's neither a limitation nor a bug, it's something that an Apache Ant user should know.
The text was updated successfully, but these errors were encountered: