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

NullPointerException when getting fields from a PDF file

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 1.7.1, 1.8.2
    • 1.8.3, 2.0.0
    • AcroForm
    • None
    • 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

        1. ICSForms201.pdf
          172 kB
          Wayne Chan

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: