org.apache.pdfbox.exceptions.COSVisitorException: Descripteur non valide

pdfbox-dev | David KELLER (JIRA) | 8 years ago
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    [jira] Updated: (PDFBOX-397) merge dont work

    pdfbox-dev | 8 years ago | David KELLER (JIRA)
    org.apache.pdfbox.exceptions.COSVisitorException: Descripteur non valide
  2. 0

    [jira] Updated: (PDFBOX-397) merge dont work

    pdfbox-dev | 8 years ago | David KELLER (JIRA)
    org.apache.pdfbox.exceptions.COSVisitorException: Descripteur non valide
  3. 0

    PDFBox - random crash when merging huge amount of files

    Stack Overflow | 3 years ago | joorva
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    [PDFBOX-1586] IndexOutOfBoundsException when saving a document (at random) - ASF JIRA | 2 years ago
    org.apache.pdfbox.exceptions.COSVisitorException: java.lang.NullPointerException
  6. 0

    Getting the following stacktrace: org.apache.pdfbox.exceptions.COSVisitorException: java.lang.IndexOutOfBoundsException: Index: 28, Size: 0 at org.apache.pdfbox.pdfwriter.COSWriter.visitFromStream( at org.apache.pdfbox.cos.COSStream.accept( at org.apache.pdfbox.cos.COSObject.accept( at org.apache.pdfbox.pdfwriter.COSWriter.doWriteObject( at org.apache.pdfbox.pdfwriter.COSWriter.doWriteBody( at org.apache.pdfbox.pdfwriter.COSWriter.visitFromDocument( at org.apache.pdfbox.cos.COSDocument.accept( at org.apache.pdfbox.pdfwriter.COSWriter.write( at at ... Caused by: java.lang.IndexOutOfBoundsException: Index: 28, Size: 0 at java.util.ArrayList.rangeCheck( at java.util.ArrayList.get( at at at at at at org.apache.pdfbox.pdfwriter.COSWriter.visitFromStream( I'll add some context. We have a "data pipeline" in which a Windows Print Monitor sends postscript into a servlet which then uses GhostScript 9.05 to convert in-memory to PDF. This PDF is then loaded into PDFBox using PDDocument.load(). At this point we split the original PDF into multiple smaller ones each of which is saved to a ByteArrayOutputStream. At the point of save() we are having serious reliability issues. Taking an original PDF from Ghostscript we have saved this into a unit test to replicate the problem without success. If we attempt to re-execute the pipeline to take the original PDF and split it, we get apparently random percentages of saved documents. For instance, on a 990 page document (text, no images), to be split into 990 1-page documents using Tomcat 7 with -Xmx=512m: Pass 1: 50% were saved, 50% ended with stack traces Pass 2: 100% were saved Pass 3: 100% were saved The same test with -Xmx=128m ended several times with just 1 document saved, the rest were stack traces. We have also seen this randomly hit a sample document consisting of four pages to be split into two two-page documents so it does not appear to be memory related. We also added code to catch the IndexOutOfBoundsException and make up to ten attempts to repeat, but it seems the save() either works the first time or not at all. We're thinking there are environmental factors here but we're now focused on getting this nailed. Any advice or assistance will be welcomed.

    Apache's JIRA Issue Tracker | 4 years ago | James Green
    org.apache.pdfbox.exceptions.COSVisitorException: java.lang.NullPointerException

    1 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.apache.pdfbox.exceptions.COSVisitorException

      Descripteur non valide

      at org.apache.pdfbox.pdfwriter.COSWriter.visitFromStream()
    2. Apache PDFBox
      1. org.apache.pdfbox.pdfwriter.COSWriter.visitFromStream(
      2. org.apache.pdfbox.cos.COSStream.accept(
      3. org.apache.pdfbox.cos.COSObject.accept(
      4. org.apache.pdfbox.pdfwriter.COSWriter.doWriteObject(
      5. org.apache.pdfbox.pdfwriter.COSWriter.doWriteBody(
      6. org.apache.pdfbox.pdfwriter.COSWriter.visitFromDocument(
      7. org.apache.pdfbox.cos.COSDocument.accept(
      8. org.apache.pdfbox.pdfwriter.COSWriter.write(
      10 frames