You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Andreas Lehmkühler (JIRA)" <ji...@apache.org> on 2013/10/27 19:17:44 UTC

[jira] [Resolved] (PDFBOX-1412) NullPointerException when getting fields from a PDF file

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

Andreas Lehmkühler resolved PDFBOX-1412.
----------------------------------------

       Resolution: Fixed
    Fix Version/s:     (was: 1.8.0)
                   2.0.0
                   1.8.3

I (finally) fixed the issue in revision 1536173. I also fixed a minor issue with the PrintFields example.

Thanks for the report

> NullPointerException when getting fields from a PDF file
> --------------------------------------------------------
>
>                 Key: PDFBOX-1412
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1412
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel.AcroForm
>    Affects Versions: 1.7.1, 1.8.2
>         Environment: I encountered this problem while running Junit tests in Netbeans on my dev machine and while running web apps in Tomcat7 on Ubuntu 11.10.
>            Reporter: Wayne Chan
>            Assignee: Andreas Lehmkühler
>            Priority: Critical
>             Fix For: 1.8.3, 2.0.0
>
>         Attachments: ICSForms201.pdf
>
>
> I am getting a NullPointerException thrown from PDField.java line 540. The problem is that the code calls COSArray.getObject(i) on line 539, which can return a NULL. Line 540 uses the returned value without first checking for NULL, thus throwing NPE when the value is NULL. The following is the stack trace:
> java.lang.NullPointerException
> 	at org.apache.pdfbox.pdmodel.interactive.form.PDField.getKids(PDField.java:540)
> 	at org.apache.pdfbox.pdmodel.interactive.form.PDFieldFactory.isButton(PDFieldFactory.java:159)
> 	at org.apache.pdfbox.pdmodel.interactive.form.PDFieldFactory.createField(PDFieldFactory.java:68)
> 	at org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm.getFields(PDAcroForm.java:203)
> 	...



--
This message was sent by Atlassian JIRA
(v6.1#6144)