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

NullPointerException when calling Splitter.split() with pdf files generated by Keynote

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 3.0.2 PDFBox
    • None
    • Utilities
    • Happens both on our server environment (Linux) and when testing locally (Windows)

    Description

      After upgrading from PDFBox 3.0.1 to version 3.0.2 I experienced a NullPointerException when using the split() method:

      java.lang.NullPointerException: Cannot invoke "org.apache.pdfbox.pdmodel.common.PDNumberTreeNode.getNumbers()" because "tree" is null
       at org.apache.pdfbox.multipdf.PDFMergerUtility.getNumberTreeAsMap(PDFMergerUtility.java:1156)
       at org.apache.pdfbox.multipdf.Splitter.cloneStructureTree(Splitter.java:192)
       at org.apache.pdfbox.multipdf.Splitter.split(Splitter.java:135)
      

       

      When testing with different inputs, I noticed that the issue only occurred when using a PDF generated from Keynote. I attached an example below to reproduce the issue.

      Downgrading to 3.0.1 again solves the issue.

      This is proably caused by PDFBOX-2725 and this commit. The issue happens in this segment of Splitter.java:

      PDNumberTreeNode srcParentTree = srcStructureTreeRoot.getParentTree();
      // srcParentTree is null here
      Map<Integer, COSObjectable> srcNumberTreeAsMap = PDFMergerUtility.getNumberTreeAsMap(srcParentTree);
      

       

      Attachments

        1. Infun2324.L02.Control.Structures.pdf
          1.04 MB
          Lucas Welscher

        Issue Links

          Activity

            People

              Unassigned Unassigned
              welscherl Lucas Welscher
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: