Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 6.0.2
-
Fix Version/s: 6.1
-
Component/s: Core/Rendering
-
Labels:None
-
Environment:All
-
Support Case References:Support Case #13661 - https://icesoft.my.salesforce.com/5007000001YFV1S
Description
When rendering the provided PDF files the following ClassCastException is thrown and prevents the content from rendering correctly:
WARNING: Error parsing content stream.
java.lang.ClassCastException: org.icepdf.core.pobjects.Stream cannot be cast to org.icepdf.core.pobjects.ImageStream
at org.icepdf.core.util.content.AbstractContentParser.consume_Do(AbstractContentParser.java:640)
at org.icepdf.core.util.content.NContentParser.parse(Unknown Source)
at org.icepdf.core.pobjects.Page.init(Page.java:384)
at org.icepdf.ri.common.views.PageViewComponentImpl$PageInitializer.run(PageViewComponentImpl.java:1169)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
WARNING: Error parsing content stream.
java.lang.ClassCastException: org.icepdf.core.pobjects.Stream cannot be cast to org.icepdf.core.pobjects.ImageStream
at org.icepdf.core.util.content.AbstractContentParser.consume_Do(AbstractContentParser.java:640)
at org.icepdf.core.util.content.NContentParser.parse(Unknown Source)
at org.icepdf.core.pobjects.Page.init(Page.java:384)
at org.icepdf.ri.common.views.PageViewComponentImpl$PageInitializer.run(PageViewComponentImpl.java:1169)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
The generator used to build the PDF in question is putting in an extra character at the end of every dictionary. The character nul or char code zero is the character that is causing the issue. When we are parsing an <<>> dictionary the nul i picked up as an element in the hash and throws of the even number of elements that would normally make up the name value pairs. This is technically a malformed PDF but it's pretty easy for us to fix.
I've added a quick fix to our object parser which should be OK but a full qa run will needed for this change.