Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.0.4
    • Fix Version/s: 5.0.7
    • Component/s: Core/Parsing
    • Labels:
      None
    • Environment:
      Windows 7, Java JDK 1.7, Build for Java 1.5 -> Target System AIX 5

      Description

      Hi dev-team.

      I just tried out one og your example codes and tried to adapt it a bit.
      I´m trying to generate PDF Thumbnails. The Code works fine on 98% of all PDF files, but some crashes with an NPE just during opening them.

      Just:
      ------------------------8<------------------------
      Document document = new Document();
      document.setFile(sFileName);
      ------------------------8<------------------------

      leads into following NPE:
      WARNING: Fatal error parsing PDF file stream.
      java.lang.NullPointerException
              at org.icepdf.core.pobjects.security.StandardSecurityHandler.getEncryptionInputStream(StandardSecurityHandler.java:213)
              at org.icepdf.core.pobjects.security.SecurityManager.getEncryptionInputStream(SecurityManager.java:238)
              at org.icepdf.core.pobjects.Stream.getDecodedInputStream(Stream.java:230)
              at org.icepdf.core.pobjects.Stream.getDecodedStreamBytes(Stream.java:168)
              at org.icepdf.core.pobjects.Stream.getDecodedByteArrayInputStream(Stream.java:147)
              at org.icepdf.core.util.Parser.getObject(Parser.java:284)
              at org.icepdf.core.util.LazyObjectLoader.loadTrailer(LazyObjectLoader.java:139)
              at org.icepdf.core.util.Library.getTrailerByFilePosition(Library.java:133)
              at org.icepdf.core.pobjects.PTrailer.onDemandLoadAndSetupPreviousTrailer(PTrailer.java:288)
              at org.icepdf.core.pobjects.CrossReference.getEntryForObject(CrossReference.java:232)
              at org.icepdf.core.util.LazyObjectLoader.loadObject(LazyObjectLoader.java:58)
              at org.icepdf.core.util.Library.getObject(Library.java:156)
              at org.icepdf.core.util.Library.getObject(Library.java:206)
              at org.icepdf.core.pobjects.Catalog.init(Catalog.java:92)
              at org.icepdf.core.pobjects.Document.setInputStream(Document.java:422)
              at org.icepdf.core.pobjects.Document.setFile(Document.java:207)
              at io.ecx.NSKPDFThumber.capturePages(NSKPDFThumber.java:86)
              at io.ecx.NSKPDFThumber.main(NSKPDFThumber.java:71)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:618)
              at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
      ------------------------8<------------------------

      Is there any possability to apend one or two PDF files to this ticket to give some files to check against?

      kind regards
      Michael

        Issue Links

          Activity

          Hide
          Michael Pöllinger added a comment -

          found it
          This is one of the PDFs causing the NPE

          Show
          Michael Pöllinger added a comment - found it This is one of the PDFs causing the NPE
          Hide
          Patrick Corless added a comment -

          Please go ahead and post the files on this thread and I can create new bugs if needed.

          The exception is a bit puzzling as the file does not use encryption, can you confirm the exception matches the attached file?

          The file you attached opens correctly in Viewer RI on Windows. Do you have another system other then AIX 5 that you can test on?

          Show
          Patrick Corless added a comment - Please go ahead and post the files on this thread and I can create new bugs if needed. The exception is a bit puzzling as the file does not use encryption, can you confirm the exception matches the attached file? The file you attached opens correctly in Viewer RI on Windows. Do you have another system other then AIX 5 that you can test on?
          Hide
          Michael Pöllinger added a comment -

          Due to file size limitation i just can provide a download link.
          I´ve uploaded you my small test-script with a new PDF which throws a NPE.

          http://www.djsnoopy.de/PDFThumber.zip

          The thumbnail will be generated, but NPE is also thrown. I think this is produced by:

          [...]
          [NPE]
          Warnung: Cross reference deferred loading failed, will fall back to linear reading.
          [...]

          So it seems that the "normal" reading failed with a NPE and afterwards the fallback wents right.
          But why than a non catchable NPE?

          Hope that helps to understand it better.

          kind regards
          Michael

          Show
          Michael Pöllinger added a comment - Due to file size limitation i just can provide a download link. I´ve uploaded you my small test-script with a new PDF which throws a NPE. http://www.djsnoopy.de/PDFThumber.zip The thumbnail will be generated, but NPE is also thrown. I think this is produced by: [...] [NPE] Warnung: Cross reference deferred loading failed, will fall back to linear reading. [...] So it seems that the "normal" reading failed with a NPE and afterwards the fallback wents right. But why than a non catchable NPE? Hope that helps to understand it better. kind regards Michael
          Hide
          Michael Pöllinger added a comment -

          NPE reproducable on Windows 7, Java JDK 1.7, Build for Java 1.5

          Show
          Michael Pöllinger added a comment - NPE reproducable on Windows 7, Java JDK 1.7, Build for Java 1.5
          Hide
          Patrick Corless added a comment -

          Thanks for the posting the new sample as it was very helpful. The file exposes a corner case where the first page's page reference is found in an previous xref stream. When this happens we error out on decoding the stream because the encrypt info was not decoded yet. In short a small change was made to avoid the null pointer error as xref streams aren't encrypted. Anyways a fix is on the trunk and 5.0.1 branch and will be in the next maintenance release.

          Show
          Patrick Corless added a comment - Thanks for the posting the new sample as it was very helpful. The file exposes a corner case where the first page's page reference is found in an previous xref stream. When this happens we error out on decoding the stream because the encrypt info was not decoded yet. In short a small change was made to avoid the null pointer error as xref streams aren't encrypted. Anyways a fix is on the trunk and 5.0.1 branch and will be in the next maintenance release.
          Hide
          Patrick Corless added a comment -

          Closing.

          Show
          Patrick Corless added a comment - Closing.
          Hide
          Michael Pöllinger added a comment -

          Thank you!

          Show
          Michael Pöllinger added a comment - Thank you!

            People

            • Assignee:
              Patrick Corless
              Reporter:
              Michael Pöllinger
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: