Wayne Chan created PDFBOX-1412:
----------------------------------
Summary: 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
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)
at com.soschat.util.PDFUtils.readPdfFields(PDFUtils.java:96)
at com.soschat.util.PDFUtils.getPermissibleMappings(PDFUtils.java:126)
at
com.soschat.util.PDFUtilsTest.testGetPermissibleMappings(PDFUtilsTest.java:63)
at
org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
at
org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82)
at
org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:240)
at
org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at
org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:180)
--
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