[
https://issues.apache.org/jira/browse/PDFBOX-5453?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17551164#comment-17551164
]
ASF subversion and git services commented on PDFBOX-5453:
---------------------------------------------------------
Commit 1901730 from Tilman Hausherr in branch 'pdfbox/trunk'
[ https://svn.apache.org/r1901730 ]
PDFBOX-5453: avoid ClassCastException
> 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
>
> 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: [email protected]
For additional commands, e-mail: [email protected]