[ 
https://issues.apache.org/jira/browse/PDFBOX-2020?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tilman Hausherr resolved PDFBOX-2020.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0.0
                   1.8.7
         Assignee: Tilman Hausherr  (was: Guillaume Bailleul)

Unlike in april, I understand the problem now: preflight was searching for a 
color space when there are no colorspaces at all in the resources. The new code 
avoids the NPE and will simply return "The ColorSpace is unknown". 

[~gbm.bailleul] The failing isartor tests were handled in PDFBOX-2179.

[~pikachuman] Please get a snapshot version (see link I posted previously in 
the other issue) and reopen this one if it doesn't work. Re "the colorspace is 
unknown": you can verify this by opening your file with the PDFDebugger command 
line app. (If you don't know how to find it in the "tree", I can attach a 
screenshot)

> PDF/A Validation raises NullPointerException for PDFs without ImageColorSpace
> -----------------------------------------------------------------------------
>
>                 Key: PDFBOX-2020
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2020
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Preflight
>    Affects Versions: 1.8.6, 1.8.7, 2.0.0
>         Environment: Windows 7, Sun JDK7 64Bit
>            Reporter: Ulrich Wohlfeil
>            Assignee: Tilman Hausherr
>              Labels: pdf/a, validation
>             Fix For: 1.8.7, 2.0.0
>
>
> 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.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to