Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 6.0.2
-
Component/s: Core/Rendering
-
Labels:None
-
Environment:ICEpdf Pro 6
-
Support Case References:Support Case #13677 - https://icesoft.my.salesforce.com/5007000001YHNZf
Description
When rendering the provided PDF in ICEpdf 6.0.2 the following NPE is thrown and prevents the content from rendering. This isn't an issue with the 5.1.2 release.
WARNING: Error initiating page: 0
java.lang.NullPointerException
at org.icepdf.core.pobjects.annotations.Annotation.init(Annotation.java:743)
at org.icepdf.core.pobjects.annotations.MarkupAnnotation.init(MarkupAnnotation.java:172)
at org.icepdf.core.pobjects.annotations.TextAnnotation.init(TextAnnotation.java:123)
at org.icepdf.core.pobjects.Page.initPageAnnotations(Page.java:299)
at org.icepdf.core.pobjects.Page.init(Page.java:341)
at org.icepdf.ri.common.views.PageViewComponentImpl$PageInitializer.run(PageViewComponentImpl.java:1169)
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)
WARNING: Error initiating page: 0
java.lang.NullPointerException
at org.icepdf.core.pobjects.annotations.Annotation.init(Annotation.java:743)
at org.icepdf.core.pobjects.annotations.MarkupAnnotation.init(MarkupAnnotation.java:172)
at org.icepdf.core.pobjects.annotations.TextAnnotation.init(TextAnnotation.java:123)
at org.icepdf.core.pobjects.Page.initPageAnnotations(Page.java:299)
at org.icepdf.core.pobjects.Page.init(Page.java:341)
at org.icepdf.ri.common.views.PageViewComponentImpl$PageInitializer.run(PageViewComponentImpl.java:1169)
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)
This NPE seems to be occurring when we only process documents created by
/CreationDate(D:20160119112538-05'00')
/Title(Created with ACI PDF Generator)
/Creator(PDFsharp 1.32.2608-g (www.pdfsharp.net))
/Producer(PDFsharp 1.32.2608-g (www.pdfsharp.net))
I'm not sure if these documents appear to even have any annotations but they are listed (/Annots[5 0 R]). It appears to be a TextAnnotation (
{T=Letter of Transmittal - 1, Type=Annot, Subtype=Text, Name=Comment, M=D:20160117124040-05'00', NM=ee9f9211-ba8b-43b0-88b3-792585c520af}).
Although this is probably not the solution, I'm able to get around this issue by updating org.icepdf.core.pobjects.Page. In this conditional, I'm updating a to be null so it doesn't get initialized.
// set the object reference, so we can save the state correct // and update any references accordingly. if (ref != null && a != null) { a.setPObjectReference(ref); a.init(); }Here I'm just updating paintAnnotation to false so it doesn't bother painting it since it wasn't initialized.
The right solution is to fix loading the annotation itself. I don't think we typically have annotations displayed in our documents so I'm wondering if for an easy fix would be to turn that functionality off with a System property?