Hi,
I am trying to get an instance of Image object using the following code
Image img = Image.getInstance(buffer);
I am reading the contents of an Image file into a byte[] array and passing it as a parameter to the above method in the variable "buffer". It works fine if I use a normal image. Incase my image is corrupt it executes forever at the following line:
com.lowagie.text.Image.skip(Unknown Source)
Please find below the details of the thread dmp when the above code is executed with a corrupt image
at java.io.ByteArrayInputStream.skip(ByteArrayInputStream.java:189)
- waiting to lock <0x9ef85b30> (a java.io.ByteArrayInputStream)
at com.lowagie.text.Image.skip(Unknown Source)
at com.lowagie.text.Jpeg.processParameters(Unknown Source)
at com.lowagie.text.Jpeg.<init>(Unknown Source)
at com.lowagie.text.Image.getInstance(Unknown Source)
- waiting to lock <0x9ef85b30> (a java.io.ByteArrayInputStream)
at com.lowagie.text.Image.skip(Unknown Source)
at com.lowagie.text.Jpeg.processParameters(Unknown Source)
at com.lowagie.text.Jpeg.<init>(Unknown Source)
at com.lowagie.text.Image.getInstance(Unknown Source)
Is there any way we can ientify the image is corrupt before invoking the "getInstance()" method? Any help is appreciated.
Thanks
Deepak
Discover Yahoo!
Stay in touch with email, IM, photo sharing & more. Check it out!
