You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Wayne Chan (JIRA)" <ji...@apache.org> on 2013/08/06 23:42:48 UTC

[jira] [Reopened] (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 ]

Wayne Chan reopened PDFBOX-1412:
--------------------------------


Still problem still exists in 1.8.2. The variable name has been changed but the issue still has not bee addressed. The problem is on line 540 of PDField.java. There needs to be a null check between line 539 and 540 to prevent a NPE. This is a critical bug that comes up when I try to parse most files with fields.
                
> 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
>         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
>             Fix For: 1.8.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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira