Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-1412

NullPointerException when getting fields from a PDF file

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 1.7.1, 1.8.2
    • Fix Version/s: 1.8.3, 2.0.0
    • Component/s: AcroForm
    • Labels:
      None
    • 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.

      Description

      I am getting a NullPointerException thrown from PDField.java line 540. The problem is that the code calls COSArray.getObject 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)
      ...

        Attachments

          Activity

            People

            • Assignee:
              lehmi Andreas Lehmkühler
              Reporter:
              waynebeast Wayne Chan
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: