You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Adam Nichols (JIRA)" <ji...@apache.org> on 2010/11/30 20:16:20 UTC

[jira] Commented: (PDFBOX-578) NPE NullPointerException in PDPageNode.getCount

    [ https://issues.apache.org/jira/browse/PDFBOX-578?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12965355#action_12965355 ] 

Adam Nichols commented on PDFBOX-578:
-------------------------------------

Although I don't like hiding the fact that there were huge parsing problems, in retrospect, I think Vincent is right.  With his patch, along with adding a null check for the "page" variable at the very beginning of getAllKids(List result, COSDictionary page, boolean recurse), it will prevent the NPE.  It will, however, make getAllPages() return null.  If nobody objects, I'm going to put this patch in here to try to gracefully deal with non-conforming PDFs.  I don't have time to look deep into SWMC_WarehouseAgreement-V1.pdf to get an uncompressed version so I can manually trace through it in a text editor right now, but that's what should be done to REALLY fix the issue at hand.  But at least this patch would avoid a NPE in the meantime.

> NPE NullPointerException in PDPageNode.getCount
> -----------------------------------------------
>
>                 Key: PDFBOX-578
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-578
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 0.8.0-incubator
>            Reporter: James Wilson
>         Attachments: 0000462526-0000000000-04cv00399.pdf, FormI-9-English.pdf, nullcount.patch, SWMC_WarehouseAgreement-V1.pdf
>
>
> java.lang.NullPointerException
>         at org.apache.pdfbox.pdmodel.PDPageNode.getCount(PDPageNode.java:102)
>         at org.apache.pdfbox.pdmodel.PDDocument.getNumberOfPages(PDDocument.java:925)
>         at us.fed.nmcourt.common.pdfbox.NmdLucenePDFDocument.addContent(NmdLucenePDFDocument.java:558)
>         at us.fed.nmcourt.common.pdfbox.NmdLucenePDFDocument.convertDocument(NmdLucenePDFDocument.java:346)
>         at us.fed.nmcourt.common.pdfbox.NmdLucenePDFDocument.getDocument(NmdLucenePDFDocument.java:444)
>         at us.fed.nmcourt.common.pdfbox.NmdLucenePDFDocument.main(NmdLucenePDFDocument.java:758)
> Attached is an example of pdf that causes this exception.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.