You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Petr Slaby (JIRA)" <ji...@apache.org> on 2014/05/30 11:10:01 UTC

[jira] [Updated] (PDFBOX-2103) JPXFilter fails to decode some Jpeg2000 images

     [ https://issues.apache.org/jira/browse/PDFBOX-2103?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Petr Slaby updated PDFBOX-2103:
-------------------------------

    Attachment: JPXFilter.java.patch
                000001_MTEXT_CS6.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
>         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)