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

PDF/A Validation raises NullPointerException for PDFs without ImageColorSpace

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.6, 1.8.7, 2.0.0
    • Fix Version/s: 1.8.7, 2.0.0
    • Component/s: Preflight
    • Labels:
    • Environment:
      Windows 7, Sun JDK7 64Bit

      Description

      TestCode: Example Code http://pdfbox.apache.org/cookbook/pdfavalidation.html

      If i check a PDF without ImageColorSpace the example Code raises the following NullPointerException:
      Exception in thread "main" java.lang.NullPointerException
      at org.apache.pdfbox.preflight.content.ContentStreamEngine.validImageColorSpace(ContentStreamEngine.java:323)
      at org.apache.pdfbox.preflight.content.ContentStreamWrapper.processOperator(ContentStreamWrapper.java:179)
      at org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:254)
      at org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:221)
      at org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:203)
      at org.apache.pdfbox.preflight.content.ContentStreamWrapper.validPageContentStream(ContentStreamWrapper.java:76)
      at org.apache.pdfbox.preflight.process.reflect.SinglePageValidationProcess.validateContent(SinglePageValidationProcess.java:180)
      at org.apache.pdfbox.preflight.process.reflect.SinglePageValidationProcess.validate(SinglePageValidationProcess.java:88)
      at org.apache.pdfbox.preflight.utils.ContextHelper.callValidation(ContextHelper.java:73)
      at org.apache.pdfbox.preflight.utils.ContextHelper.validateElement(ContextHelper.java:52)
      at org.apache.pdfbox.preflight.process.PageTreeValidationProcess.validatePage(PageTreeValidationProcess.java:58)
      at org.apache.pdfbox.preflight.process.PageTreeValidationProcess.validate(PageTreeValidationProcess.java:47)
      at org.apache.pdfbox.preflight.utils.ContextHelper.callValidation(ContextHelper.java:73)
      at org.apache.pdfbox.preflight.utils.ContextHelper.validateElement(ContextHelper.java:88)
      at org.apache.pdfbox.preflight.PreflightDocument.validate(PreflightDocument.java:169)
      at PdfBox.main(PdfBox.java:33)

      I think the method org.apache.pdfbox.pdmodel.PDResources.getColorSpaces (PDResources.java:311) did not return a object if their is no image color space but the code line org.apache.pdfbox.preflight.content.ContentStreamEngine.validImageColorSpace(ContentStreamEngine.java:323) expects a object in any case.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                tilman Tilman Hausherr
                Reporter:
                uwohlfeil Ulrich Wohlfeil
              • Votes:
                1 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: