ICEpdf
  1. ICEpdf
  2. PDF-406

JAI causing "End of data reached before next EOL encountered."

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.3.2
    • Fix Version/s: 4.3.4
    • Component/s: Core/Parsing
    • Labels:
      None
    • Environment:
      Java Advanced Imaging library (attached).
    • Workaround Description:
      Remove JAI from the class path.

      Description

      The exception below is thrown when JAI is present on the classpath and when attempting to render the sample PDF (11063.pdf). The PDF rendering differs from that of Adobe.

      Mar 13, 2012 11:06:27 AM org.icepdf.core.pobjects.filters.CCITTFax deriveBufferedImageFromTIFFBytes
      FINE: deriveBufferedImageFromTIFFBytes() : Could not derive image from data bytes:
      java.lang.ArrayIndexOutOfBoundsException
      Mar 13, 2012 11:06:27 AM org.icepdf.core.pobjects.filters.CCITTFax deriveBufferedImageFromTIFFBytes
      FINE: deriveBufferedImageFromTIFFBytes() : Could not derive image from data bytes:
      java.lang.Error: End of data reached before next EOL encountered.
      at com.sun.media.jai.codecimpl.TIFFFaxDecoder.readEOL(TIFFFaxDecoder.java:1288)
      at com.sun.media.jai.codecimpl.TIFFFaxDecoder.decode2D(TIFFFaxDecoder.java:791)
      at com.sun.media.jai.codecimpl.TIFFImage.getTile(TIFFImage.java:1063)
      at javax.media.jai.RenderedImageAdapter.getTile(RenderedImageAdapter.java:156)
      at javax.media.jai.NullOpImage.computeTile(NullOpImage.java:170)

        Activity

        Hide
        Patrick Corless added a comment -

        There is a temporary work around in which if JAI is removed from the class path all will be good for this PDF. Working on a better solution going forward.

        Show
        Patrick Corless added a comment - There is a temporary work around in which if JAI is removed from the class path all will be good for this PDF. Working on a better solution going forward.
        Hide
        Patrick Corless added a comment -

        The root cause of the problem was related to some code we have that will try various tiff headers on the data stream before decoding it with JAI. The specific problem in this case is that the incorrect header information decodes without error and we get a garbled image.

        The CCITTFaxDecoder was added a few versions ago that does a really nice job at decoding Tiffs. I've reworked the stream object logic to try CCITTFaxDecoder first and then only on a failure fall back to JAI.

        Show
        Patrick Corless added a comment - The root cause of the problem was related to some code we have that will try various tiff headers on the data stream before decoding it with JAI. The specific problem in this case is that the incorrect header information decodes without error and we get a garbled image. The CCITTFaxDecoder was added a few versions ago that does a really nice job at decoding Tiffs. I've reworked the stream object logic to try CCITTFaxDecoder first and then only on a failure fall back to JAI.
        Hide
        Patrick Corless added a comment -

        The previously mentioned code changes are pretty high risk for regression. I have to run the change through QA. With a little luck there won't be any regressions and I won't have to reopen this issue.

        Show
        Patrick Corless added a comment - The previously mentioned code changes are pretty high risk for regression. I have to run the change through QA. With a little luck there won't be any regressions and I won't have to reopen this issue.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: