[
https://issues.apache.org/jira/browse/PDFBOX-2103?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14013907#comment-14013907
]
Tilman Hausherr commented on PDFBOX-2103:
-----------------------------------------
Just for the record, the described NPE didn't happen for me. Maybe it depends
on what JAI version is used. Anyway, it means we have yet another interesting
test PDF :-)
> JPXFilter fails to decode some Jpeg2000 images
> ----------------------------------------------
>
> Key: PDFBOX-2103
> URL: https://issues.apache.org/jira/browse/PDFBOX-2103
> Project: PDFBox
> Issue Type: Bug
> Components: Rendering
> Affects Versions: 2.0.0
> Reporter: Petr Slaby
> Assignee: Andreas Lehmkühler
> Fix For: 2.0.0
>
> Attachments: 000001_MTEXT_CS6.pdf, JPXFilter.java.patch
>
>
> Most of the images in the attached PDF are missing when rendered via PDFBox
> (tested in 2.0 head). The reason is a NullPointerException in ImageIO:
> java.lang.NullPointerException
> at
> com.sun.media.imageioimpl.plugins.jpeg2000.J2KMetadata.replace(J2KMetadata.java:962)
> at
> com.sun.media.imageioimpl.plugins.jpeg2000.J2KMetadata.addNode(J2KMetadata.java:631)
> at
> jj2000.j2k.fileformat.reader.FileFormatReader.readFileFormat(FileFormatReader.java:279)
> at
> com.sun.media.imageioimpl.plugins.jpeg2000.J2KReadState.initializeRead(J2KReadState.java:418)
> at
> com.sun.media.imageioimpl.plugins.jpeg2000.J2KReadState.<init>(J2KReadState.java:189)
> at
> com.sun.media.imageioimpl.plugins.jpeg2000.J2KImageReader.read(J2KImageReader.java:443)
> at javax.imageio.ImageReader.read(Unknown Source)
> at org.apache.pdfbox.filter.JPXFilter.readJPX(JPXFilter.java:84)
> at org.apache.pdfbox.filter.JPXFilter.decode(JPXFilter.java:58)
> ...
> To avoid the problem, the ImageIO has to be instructed to skip reading
> metadata of the image, i.e. use reader.setInput(iis, true, true) instead of
> reader.setInput(iis) as shown in the attached patch. This is also what
> ImageIO.read(stream) does - the method that was used before the commit
> 1570806.
--
This message was sent by Atlassian JIRA
(v6.2#6252)