Home pageFind It!Contact PJAPJA documentation

PJA

 PJA Toolkit forum

This forum is dedicated to PJA Toolkit.
You may read freely the messages it contents. If you want to write a message or answer to a subject, subscribe to it first.

Subjects Recent messages Login Subscribe

Messages of subject Decoding JPEGs -> NullPointerException

Lars

Member since : Feb 12, 2004
Messages : 2
 Feb 12, 2004 at 9:36 AM
Hi there,

we're using PJA2.4 in a WebApplication on WebSphere 3.5 running on an AS/400. Everything worked fine so far (PDF generation with FOP), but now we wanted to load JPEG images and all we get is a NullpointerException in Sun's decoder class. Is this problem known to someone? Are there any solutions?
One way to go would be another JPEG decoder, but till now I haven't found one. Are there any free JPEG decoders available?

The stacktrace is the following:
java.lang.NullPointerException
sun/awt/image/JPEGImageDecoder.produceImage()V+24 (JPEGImageDecoder.java:152)
sun/awt/image/InputStreamImageSource.doFetch()V+59 (InputStreamImageSource.java:248)
sun/awt/image/ImageFetcher.fetchloop()V+29 (ImageFetcher.java:221)
sun/awt/image/ImageFetcher.run()V+4 (ImageFetcher.java:189)

Thanks for your help,
Lars Heller

Lars

Member since : Feb 12, 2004
Messages : 2
 Feb 13, 2004 at 8:56 AM
I found a workaround. Instead of calling

toolkit.getImage(path);

I created the JPEGDecoder and used its API directly:

com.sun.image.codec.jpeg.JPEGImageDecoder decoder
= com.sun.image.codec.jpeg.JPEGCodec.createJPEGDecoder(new java.io.FileInputStream(path));
decoder.decodeAsBufferedImage();

This works for me. So I suppose it has something to do with PJA's Toolkit implementation? Just a guess.


Home pageFind It!ContactTop

© Copyrights 1997-2023 eTeks - All rights reserved

PJAPJA documentation