ICEpdf
  1. ICEpdf
  2. PDF-586

String cannot be cast to org.icepdf.core .pobjects.Stream

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.0.1
    • Fix Version/s: 5.0.2, 5.0.3
    • Component/s: None
    • Labels:
      None
    • Environment:
      Pro, JAI
    • Salesforce Case Reference:

      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)

        Activity

        Hide
        Patrick Corless added a comment -

        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.

        Show
        Patrick Corless added a comment - 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.
        Hide
        Patrick Corless added a comment -

        Updated 5.0.1 branch and trunk with batch.

        Show
        Patrick Corless added a comment - Updated 5.0.1 branch and trunk with batch.
        Hide
        Patrick Corless added a comment -

        Verified with final bundle

        Show
        Patrick Corless added a comment - Verified with final bundle

          People

          • Assignee:
            Patrick Corless
            Reporter:
            Tyler Johnson
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: