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

java.lang.IndexOutOfBoundsException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Duplicate
    • 2.0.22, 3.0.0 PDFBox
    • None
    • PDModel, Utilities
    • None

    Description

      Caused by: java.lang.IndexOutOfBoundsException: Index: 111, Size: 111
          at java.util.ArrayList.rangeCheck(ArrayList.java:657)
          at java.util.ArrayList.get(ArrayList.java:433)
          at org.apache.pdfbox.cos.COSArray.getObject(COSArray.java:188)
          at org.apache.pdfbox.pdmodel.common.PDNameTreeNode.getNames(PDNameTreeNode.java:272)
          at org.apache.pdfbox.multipdf.PDFMergerUtility.getIDTreeAsMap(PDFMergerUtility.java:1036)
          at org.apache.pdfbox.multipdf.PDFMergerUtility.getIDTreeAsMap(PDFMergerUtility.java:1051)
          at org.apache.pdfbox.multipdf.PDFMergerUtility.mergeIDTree(PDFMergerUtility.java:1008)
          at org.apache.pdfbox.multipdf.PDFMergerUtility.appendDocument(PDFMergerUtility.java:877)
          at org.apache.pdfbox.multipdf.PDFMergerUtility.legacyMergeDocuments(PDFMergerUtility.java:459)
          at org.apache.pdfbox.multipdf.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:346)
          at com.vuram.plugins.pdfutilities.MergePDF.runSmartService(MergePDF.java:46)
          at com.vuram.plugins.pdfutilities.AbstractPDFDocumentGeneration.run(AbstractPDFDocumentGeneration.java:66)
          ... 16 more

       

      We are facing the above error on merging certain types of pdf documents unfortunately we will not be sharing the files.

      Please find the snippet below,

      PDFMergerUtility mergePdf = new PDFMergerUtility();

              for (Long filename : documents)

      {             documentPath = cs.getInternalFilename(filename);             mergePdf.addSource(new File(documentPath));         }

              mergePdf.setDestinationFileName(cs.getInternalFilename(docId));
              mergePdf.mergeDocuments(MemoryUsageSetting.setupTempFileOnly());

       

      We found the suggested solution in the below ticket but still issue is persist.

      URL : https://issues.apache.org/jira/browse/PDFBOX-5072

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              kris007 krishnan
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: