jai-imageio / jai-imageio-core

JAI ImageIO Core (without javax.media.jai dependencies)
Other
234 stars 88 forks source link

ConverterTest fails with vendorName == null #5

Closed stain closed 10 years ago

stain commented 10 years ago

On 11 September 2014 10:42, Brad Polant brad.polant@corista.com wrote:

Hi I hope you don't find a foolish sounding question but when I build the code from

http://stain.github.io/jai-imageio-core/ and run the unit-tests I get (after removing *ignore) I get this

java.util.ServiceConfigurationError: javax.imageio.spi.ImageReaderSpi: Provider com.sun.media.imageioimpl.plugins.jpeg2000.J2KImageReaderSpi could not be instan tiated: java.lang.IllegalArgumentException: vendorName == null! at javax.imageio.spi.IIOServiceProvider.(IIOServiceProvider.java:7 6) at javax.imageio.spi.ImageReaderWriterSpi.(ImageReaderWriterSpi.ja va:231)

I checked the Manifest.MF and it seems ok, Do you mind a quick hint?
Thanks Brad Polant

Stian: I had earlier @Ignore'd the "test" as it turned out to not really be a unit test at all - for instance it just prints out any error rather than failing on them.

I can replicate this problem, with OpenJDK 1.7.0_55 from LinuxMint 17.

I get the failure on com.sun.media.imageioimpl.stream.ChannelImageInputStreamSpi instead of J2KImageReaderSpi - I guess it could happen on any of them.

It seems to be caused by com.sun.media.imageioimpl.common.PackageUtil which assumes the code is being run from inside a JAR where it can access the Manifest - however during mvn test this is not the case as it is just running from target/classes.

To do it properly through a JAR you would have to move the test to a different module and add jai-image-core as a dependency. I must admit I have not tested this particular scenario, but at least when we are using image-io we use it as a JAR and therefore the SPIs work as intended.

stain commented 10 years ago

Fixed for version 1.2-pre-dr-b04-2014-09-12