ICEpdf
  1. ICEpdf
  2. PDF-1014

NullPointerException thrown at MarkupAnnotationComponent.mouseClicked

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 6.1.2
    • Fix Version/s: 6.1.3
    • Component/s: Core/Rendering
    • Labels:
      None
    • Environment:
      All

      Description

      A NullPointerException is thrown when trying to re-open a collapsed annotation with the provided PDF file.

      To reproduce the issue:
       - Add an annotation to the page.
       - Double click to open the popup
       - Minimize the popup.
       - Double click the annotation, the NPE is thrown and can't get the popup open again.

      Stack trace:
      Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
      at org.icepdf.ri.common.views.annotations.MarkupAnnotationComponent.mouseClicked(MarkupAnnotationComponent.java:92)
      at java.awt.Component.processMouseEvent(Component.java:6519)
      at javax.swing.JComponent.processMouseEvent(JComponent.java:3320)
      at java.awt.Component.processEvent(Component.java:6281)
      at java.awt.Container.processEvent(Container.java:2229)
      at java.awt.Component.dispatchEventImpl(Component.java:4872)
      at java.awt.Container.dispatchEventImpl(Container.java:2287)
      at java.awt.Component.dispatchEvent(Component.java:4698)
      at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
      at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4501)
      at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
      at java.awt.Container.dispatchEventImpl(Container.java:2273)
      at java.awt.Window.dispatchEventImpl(Window.java:2719)
      at java.awt.Component.dispatchEvent(Component.java:4698)
      at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735)
      at java.awt.EventQueue.access$200(EventQueue.java:103)
      at java.awt.EventQueue$3.run(EventQueue.java:694)
      at java.awt.EventQueue$3.run(EventQueue.java:692)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
      at java.awt.EventQueue$4.run(EventQueue.java:708)
      at java.awt.EventQueue$4.run(EventQueue.java:706)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
      at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

        Activity

        Hide
        Arran Mccullough added a comment -

        Also seeing a ClassCastException with this PDF file.

        To reproduce:

        • Add a Text Annotation to the page.
        • Minimize the popup.
        • Click and drag the annotation, the following error is thrown:
          Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: org.icepdf.core.pobjects.annotations.LinkAnnotation cannot be cast to org.icepdf.core.pobjects.Reference
          at org.icepdf.core.pobjects.Page.updateAnnotation(Page.java:958)
          at org.icepdf.ri.common.views.annotations.AnnotationState.synchronizeState(AnnotationState.java:113)
          at org.icepdf.ri.common.views.annotations.AnnotationState.restore(AnnotationState.java:84)
          at org.icepdf.ri.common.views.annotations.AnnotationState.apply(AnnotationState.java:67)
          at org.icepdf.ri.common.SwingController.propertyChange(SwingController.java:4708)
          at java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:335)
          at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:327)
          at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:263)
          at org.icepdf.ri.common.views.DocumentViewControllerImpl.firePropertyChange(DocumentViewControllerImpl.java:1227)
          at org.icepdf.ri.common.views.annotations.AbstractAnnotationComponent.mouseReleased(AbstractAnnotationComponent.java:619)
          at java.awt.Component.processMouseEvent(Component.java:6516)
          at javax.swing.JComponent.processMouseEvent(JComponent.java:3320)
          at java.awt.Component.processEvent(Component.java:6281)
          at java.awt.Container.processEvent(Container.java:2229)
          at java.awt.Component.dispatchEventImpl(Component.java:4872)
          at java.awt.Container.dispatchEventImpl(Container.java:2287)
          at java.awt.Component.dispatchEvent(Component.java:4698)
          at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
          at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
          at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
          at java.awt.Container.dispatchEventImpl(Container.java:2273)
          at java.awt.Window.dispatchEventImpl(Window.java:2719)
          at java.awt.Component.dispatchEvent(Component.java:4698)
          at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735)
          at java.awt.EventQueue.access$200(EventQueue.java:103)
          at java.awt.EventQueue$3.run(EventQueue.java:694)
          at java.awt.EventQueue$3.run(EventQueue.java:692)
          at java.security.AccessController.doPrivileged(Native Method)
          at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
          at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
          at java.awt.EventQueue$4.run(EventQueue.java:708)
          at java.awt.EventQueue$4.run(EventQueue.java:706)
          at java.security.AccessController.doPrivileged(Native Method)
          at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
          at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
          at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
          at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
          at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
          at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
          at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
          at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
        Show
        Arran Mccullough added a comment - Also seeing a ClassCastException with this PDF file. To reproduce: Add a Text Annotation to the page. Minimize the popup. Click and drag the annotation, the following error is thrown: Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: org.icepdf.core.pobjects.annotations.LinkAnnotation cannot be cast to org.icepdf.core.pobjects.Reference at org.icepdf.core.pobjects.Page.updateAnnotation(Page.java:958) at org.icepdf.ri.common.views.annotations.AnnotationState.synchronizeState(AnnotationState.java:113) at org.icepdf.ri.common.views.annotations.AnnotationState.restore(AnnotationState.java:84) at org.icepdf.ri.common.views.annotations.AnnotationState.apply(AnnotationState.java:67) at org.icepdf.ri.common.SwingController.propertyChange(SwingController.java:4708) at java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:335) at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:327) at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:263) at org.icepdf.ri.common.views.DocumentViewControllerImpl.firePropertyChange(DocumentViewControllerImpl.java:1227) at org.icepdf.ri.common.views.annotations.AbstractAnnotationComponent.mouseReleased(AbstractAnnotationComponent.java:619) at java.awt.Component.processMouseEvent(Component.java:6516) at javax.swing.JComponent.processMouseEvent(JComponent.java:3320) at java.awt.Component.processEvent(Component.java:6281) at java.awt.Container.processEvent(Container.java:2229) at java.awt.Component.dispatchEventImpl(Component.java:4872) at java.awt.Container.dispatchEventImpl(Container.java:2287) at java.awt.Component.dispatchEvent(Component.java:4698) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422) at java.awt.Container.dispatchEventImpl(Container.java:2273) at java.awt.Window.dispatchEventImpl(Window.java:2719) at java.awt.Component.dispatchEvent(Component.java:4698) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735) at java.awt.EventQueue.access$200(EventQueue.java:103) at java.awt.EventQueue$3.run(EventQueue.java:694) at java.awt.EventQueue$3.run(EventQueue.java:692) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87) at java.awt.EventQueue$4.run(EventQueue.java:708) at java.awt.EventQueue$4.run(EventQueue.java:706) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:705) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138) at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
        Hide
        Patrick Corless added a comment -

        It would appear the error is related to the encoder putting a direct object in the page annotation dictionary. This is technically malformed as the specification states that the array of annotations should be indirect references. The entry looks like this,

        /Annots [
        <</Type /Annot /Subtype /Link /Rect [511.57 27.26 552.48 19.26] /Contents (þÿ h t t p : / /some url d f) /NM (þÿ 0 0 0 1 - 0 0 0 0) /M (D:20090716235813) /Border [0 0 0] /C [] /A <</S /URI /URI (http://some uri)>> /H /I>>
        ]
        Normally it would look something like this
        /Annots [ 43 0 R ]
        where 43 0 R would be defined as it's own object.
        43 0 obj << ... >> endobj

        If I adjust for the null pointer which is the result of how a popup lookup has to happen then every thing work OK, even on the save.

        Show
        Patrick Corless added a comment - It would appear the error is related to the encoder putting a direct object in the page annotation dictionary. This is technically malformed as the specification states that the array of annotations should be indirect references. The entry looks like this, /Annots [ <</Type /Annot /Subtype /Link /Rect [511.57 27.26 552.48 19.26] /Contents (þÿ h t t p : / /some url d f) /NM (þÿ 0 0 0 1 - 0 0 0 0) /M (D:20090716235813) /Border [0 0 0] /C [] /A <</S /URI /URI ( http://some uri)>> /H /I>> ] Normally it would look something like this /Annots [ 43 0 R ] where 43 0 R would be defined as it's own object. 43 0 obj << ... >> endobj If I adjust for the null pointer which is the result of how a popup lookup has to happen then every thing work OK, even on the save.
        Hide
        Patrick Corless added a comment -

        Based QA, marking as fixed.

        Show
        Patrick Corless added a comment - Based QA, marking as fixed.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: