Skip to main content

ImageIO throws a NPE reading a byteArray of an JPEG2K image

5 replies [Last post]
ltan
Offline
Joined: 2010-05-12

I am executing the following code:

bi = ImageIO.read(byteArray);

For one particular JPEG2K image that I am processing, it throws a Throwable NPE. I have been processing others JPEG and JPEG2K just fine. I am using the latest stable version of ImageIO (1.1).

I appreciate if you can share some resolution to this one. I have been searching on the forum and cannot find anything close to this.
Thanks.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
ltan
Offline
Joined: 2010-05-12

I found an url that contains the daily builds of the jai_ImageIO which solved my problem. After I installed the files into my java directory, the picture is displayed correctly:

https://jai-imageio.dev.java.net/binary-builds.html

Now I am watching to see when this version jai-imageio-(1_2) is declared to be stable.

Nidel, Mike

Don't hold your breath... I don't think that will ever happen.
It's the sad reality of JAI and JAI-ImageIO.

> -----Original Message-----
> From: jai-imageio@javadesktop.org [mailto:jai-imageio@javadesktop.org]
> Sent: Thursday, May 13, 2010 5:03 PM
> To: interest@jai-imageio.dev.java.net
> Subject: [JAI-IMAGEIO] Re: ImageIO throws a NPE reading a byteArray of
> an JPEG2K image
>
> I found an url that contains the daily builds of the jai_ImageIO which
> solved my problem. After I installed the files into my java directory,
> the picture is displayed correctly:
>
> https://jai-imageio.dev.java.net/binary-builds.html
>
> Now I am watching to see when this version jai-imageio-(1_2) is
> declared to be stable.
> [Message sent by forum member 'ltan']
>
> http://forums.java.net/jive/thread.jspa?messageID=469738
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

ltan
Offline
Joined: 2010-05-12

Thanks for your reply.

Why do you think that we will never see a statble 1_2 version?
Supposed I want to implement the option you described earlier on the version 1_1, how would I do that? I am including the imageIo jar in my project.

Thanks.

ltan
Offline
Joined: 2010-05-12

Additional info: with stack trace of ImageIO:

Throwable message from ImageIO.read(): java.lang.NullPointerException
com.sun.media.imageioimpl.plugins.jpeg2000.J2KMetadata replace + 962
com.sun.media.imageioimpl.plugins.jpeg2000.J2KMetadata addNode + 631
com.sun.media.imageioimpl.plugins.jpeg2000.J2KRenderedImageCodecLib readImageMetadata + 1006
com.sun.media.imageioimpl.plugins.jpeg2000.J2KRenderedImageCodecLib createOriginalSampleModel + 673
com.sun.media.imageioimpl.plugins.jpeg2000.J2KRenderedImageCodecLib + 261
com.sun.media.imageioimpl.plugins.jpeg2000.J2KImageReaderCodecLib read + 364
javax.imageio.ImageIO read + 1422
javax.imageio.ImageIO read + 1326

Nidel, Mike

You might try disabling the CodecLib.

-Dcom.sun.media.imageio.disableCodecLib=true

(or remove the native libraries)

> -----Original Message-----
> From: jai-imageio@javadesktop.org [mailto:jai-imageio@javadesktop.org]
> Sent: Thursday, May 13, 2010 2:15 PM
> To: interest@jai-imageio.dev.java.net
> Subject: [JAI-IMAGEIO] Re: ImageIO throws a NPE reading a byteArray of
> an JPEG2K image
>
> Additional info: with stack trace of ImageIO:
>
> Throwable message from ImageIO.read(): java.lang.NullPointerException
> com.sun.media.imageioimpl.plugins.jpeg2000.J2KMetadata replace + 962
> com.sun.media.imageioimpl.plugins.jpeg2000.J2KMetadata addNode + 631
> com.sun.media.imageioimpl.plugins.jpeg2000.J2KRenderedImageCodecLib
> readImageMetadata + 1006
> com.sun.media.imageioimpl.plugins.jpeg2000.J2KRenderedImageCodecLib
> createOriginalSampleModel + 673
> com.sun.media.imageioimpl.plugins.jpeg2000.J2KRenderedImageCodecLib
> + 261
> com.sun.media.imageioimpl.plugins.jpeg2000.J2KImageReaderCodecLib read
> + 364
> javax.imageio.ImageIO read + 1422
> javax.imageio.ImageIO read + 1326
> [Message sent by forum member 'ltan']
>
> http://forums.java.net/jive/thread.jspa?messageID=469714
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net