Details
-
Type: Bug
-
Status: Closed
-
Priority: 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
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
- is duplicated by
-
PDF-682 NPE when opening encrypted PDF with IcePDF 5.0.4
- Closed
found it
This is one of the PDFs causing the NPE