[ 
https://issues.apache.org/jira/browse/PDFBOX-5453?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17551185#comment-17551185
 ] 

John Petersam commented on PDFBOX-5453:
---------------------------------------

Hi Tilman,
Thanks for making quick work of this.  I can confirm that it is resolved.

Thanks again!

> 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.24, 2.0.26
>            Reporter: John Petersam
>            Priority: Major
>             Fix For: 2.0.27, 3.0.0 PDFBox
>
>
> 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