Details
Description
The PDF renders correctly but the following is thrown on page 2:
WARNING: Error initiating page: 2
java.lang.ClassCastException: java.lang.String cannot be cast to org.icepdf.core
.pobjects.Stream
at org.icepdf.core.pobjects.Page.initPageContents(Page.java:231)
at org.icepdf.core.pobjects.Page.init(Page.java:335)
at org.icepdf.ri.common.views.PageViewComponentImpl$PageInitializer.run(PageVie
wComponentImpl.java:1008)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.ja
va:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:9
18)
at java.lang.Thread.run(Thread.java:680)
java.lang.ClassCastException: java.lang.String cannot be cast to org.icepdf.core
.pobjects.Stream
at org.icepdf.core.pobjects.Page.initPageContents(Page.java:231)
at org.icepdf.core.pobjects.Page.init(Page.java:335)
at org.icepdf.ri.common.views.PageViewComponentImpl$PageInitializer.run(PageVie
wComponentImpl.java:1008)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.ja
va:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:9
18)
at java.lang.Thread.run(Thread.java:680)
WARNING: Error initiating page: 2
java.lang.ClassCastException: java.lang.String cannot be cast to org.icepdf.core
.pobjects.Stream
at org.icepdf.core.pobjects.Page.initPageContents(Page.java:231)
at org.icepdf.core.pobjects.Page.init(Page.java:335)
at org.icepdf.ri.common.views.PageViewComponentImpl$PageInitializer.run(PageVie
wComponentImpl.java:1008)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.ja
va:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:9
18)
at java.lang.Thread.run(Thread.java:680)
java.lang.ClassCastException: java.lang.String cannot be cast to org.icepdf.core
.pobjects.Stream
at org.icepdf.core.pobjects.Page.initPageContents(Page.java:231)
at org.icepdf.core.pobjects.Page.init(Page.java:335)
at org.icepdf.ri.common.views.PageViewComponentImpl$PageInitializer.run(PageVie
wComponentImpl.java:1008)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.ja
va:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:9
18)
at java.lang.Thread.run(Thread.java:680)
The file in question is malformed, on the third page there the content stream is specified by the object stream 16 0 obj which is not properly terminated. My guess is that there is an issue with the PDF encoder PDF-XChange when no content is specified for a page. The issue is pretty easy to compensate for with a few checks in the page class. I won't look to fix this at the parser level as it is an odd corner case that we've never seen before.