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/10/28 16:40:31 UTC

[jira] [Commented] (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:comment-tabpanel&focusedCommentId=13806857#comment-13806857 ] 

Wayne Chan commented on PDFBOX-1412:
------------------------------------

Which version should I use in POM so that it includes the fix?

> 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)