ICEpdf
  1. ICEpdf
  2. PDF-805

Problem loading JPEG image via ImageIO: IOException: closed

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.0.7, 5.1
    • Fix Version/s: 5.1
    • Component/s: Core/Parsing
    • Labels:
      None
    • Environment:
      All

      Description

      When rendering the provided PDF file, images are not rendered correctly and the following error is thrown in the logs (with 5.1.0 BETA):

      Sep 15, 2014 8:54:30 AM org.icepdf.core.pobjects.ImageStream dctDecode
      FINE: Problem loading JPEG image via ImageIO:
      java.io.IOException: closed
      at javax.imageio.stream.ImageInputStreamImpl.checkClosed(ImageInputStreamImpl.java:110)
      at javax.imageio.stream.ImageInputStreamImpl.close(ImageInputStreamImpl.java:857)
      at javax.imageio.stream.FileCacheImageInputStream.close(FileCacheImageInputStream.java:250)
      at org.icepdf.core.pobjects.ImageStream.dctDecode(ImageStream.java:558)
      at org.icepdf.core.pobjects.ImageStream.getImage(ImageStream.java:341)
      at org.icepdf.core.pobjects.ImageStream.getImage(ImageStream.java:288)
      at org.icepdf.core.pobjects.graphics.SmoothScaledImageReference.call(SmoothScaledImageReference.java:98)
      at org.icepdf.core.pobjects.graphics.SmoothScaledImageReference.call(SmoothScaledImageReference.java:39)
      at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      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 following is seen in the logs with 5.0.7:

      Sep 15, 2014 8:58:14 AM org.icepdf.core.pobjects.ImageStream dctDecode
      FINE: Problem loading JPEG image via JAI:
      java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.icepdf.core.pobjects.ImageStream.dctDecode(ImageStream.java:649)
      at org.icepdf.core.pobjects.ImageStream.getImage(ImageStream.java:369)
      at org.icepdf.core.pobjects.ImageStream.getImage(ImageStream.java:308)
      at org.icepdf.core.pobjects.graphics.SmoothScaledImageReference.call(SmoothScaledImageReference.java:95)
      at org.icepdf.core.pobjects.graphics.SmoothScaledImageReference.call(SmoothScaledImageReference.java:39)
      at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      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)
      Caused by: java.lang.RuntimeException: - Unable to render RenderedOp for this operation.
      at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:827)
      at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:867)
      at javax.media.jai.RenderedOp.getColorModel(RenderedOp.java:2242)
      at javax.media.jai.PlanarImage.getAsBufferedImage(PlanarImage.java:2498)
      at javax.media.jai.PlanarImage.getAsBufferedImage(PlanarImage.java:2546)
      ... 13 more

        Activity

        Hide
        Patrick Corless added a comment -

        Marking as resolved.

        Show
        Patrick Corless added a comment - Marking as resolved.
        Hide
        Patrick Corless added a comment -

        The errors in question also happens in 5.0.x. The images are all inline images in the content stream and it would appear that an extra LF characters at the start of the stream is causing the JPEG decoder to fail. I've added some code to sniff out any extra white space and the images now render correctly.

        Show
        Patrick Corless added a comment - The errors in question also happens in 5.0.x. The images are all inline images in the content stream and it would appear that an extra LF characters at the start of the stream is causing the JPEG decoder to fail. I've added some code to sniff out any extra white space and the images now render correctly.

          People

          • Assignee:
            Patrick Corless
            Reporter:
            Arran Mccullough
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: