John Petersam created PDFBOX-5453:
-------------------------------------

             Summary: ClassCastException (PDColor.java:66)
                 Key: PDFBOX-5453
                 URL: https://issues.apache.org/jira/browse/PDFBOX-5453
             Project: PDFBox
          Issue Type: Bug
          Components: PDModel
    Affects Versions: 2.0.26, 2.0.24
            Reporter: John Petersam


We are currently running PDFBox 2.0.24 & 2.0.26, but I see the code is 
identical in the trunk.

Certain PDFs are throwing the exception shown below in our production system.  
In these cases,  rather than the array containing a list of COSNumbers, it 
actually contains a single item - another COSArray.

That COSArray then has an array of COSNumbers.  If I insert the following lines 
of code at line 62 to use the inner COSArray, the PDF renders properly.

{{            *if ((array.size() == 1) && (array.get(0) instanceof COSArray))*}}
{{                *array = (COSArray) array.get(0);*}}

 

Unfortunately, we do not generate the PDFs ourselves and our documents contain 
sensitive information so I am unable to provide an example.

 

*Exception:*

{{java.lang.ClassCastException: class org.apache.pdfbox.cos.COSArray cannot be 
cast to class org.apache.pdfbox.cos.COSNumber (org.apache.pdfbox.cos.COSArray 
and org.apache.pdfbox.cos.COSNumber are in unnamed module of loader 'app')}}
{{at org.apache.pdfbox.pdmodel.graphics.color.PDColor.(PDColor.java:66)}}
{{at 
org.apache.pdfbox.pdmodel.interactive.annotation.handlers.PDFreeTextAppearanceHandler.extractNonStrokingColor(PDFreeTextAppearanceHandler.java:424)}}
{{at 
org.apache.pdfbox.pdmodel.interactive.annotation.handlers.PDFreeTextAppearanceHandler.generateNormalAppearance(PDFreeTextAppearanceHandler.java:111)}}
{{at 
org.apache.pdfbox.pdmodel.interactive.annotation.handlers.PDFreeTextAppearanceHandler.generateAppearanceStreams(PDFreeTextAppearanceHandler.java:75)}}
{{at 
org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationMarkup.constructAppearances(PDAnnotationMarkup.java:897)}}
{{at 
org.apache.pdfbox.rendering.PageDrawer.showAnnotation(PageDrawer.java:1521)}}
{{at org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:281)}}
{{at org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:347)}}
{{at org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:268)}}



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to