Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-5541

NullPointerException in SubscribeAnnotationEventSubscriptionInvoker on remove of component from page

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 6.14.0
    • Fix Version/s: 7.0.0-M1, 6.15.0
    • Component/s: wicket-atmosphere
    • Labels:
      None

      Description

      Following NullPointerException occurs on atmosphere event subscription, if the component, belonging to this event was removed from page before:

      java.lang.NullPointerException: null
      at org.apache.wicket.atmosphere.SubscribeAnnotationEventSubscriptionInvoker.invoke(SubscribeAnnotationEventSubscriptionInvoker.java:34) ~[wicket-atmosphere-0.16.jar:0.16]
      at org.apache.wicket.atmosphere.AtmosphereRequestHandler.invokeMethod(AtmosphereRequestHandler.java:104) ~[wicket-atmosphere-0.16.jar:0.16]
      at org.apache.wicket.atmosphere.AtmosphereRequestHandler.executeHandlers(AtmosphereRequestHandler.java:81) ~[wicket-atmosphere-0.16.jar:0.16]
      at org.apache.wicket.atmosphere.AtmosphereRequestHandler.respond(AtmosphereRequestHandler.java:70) ~[wicket-atmosphere-0.16.jar:0.16]
      at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:862) ~[wicket-core-6.14.0.jar:6.14.0]
      at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64) ~[wicket-request-6.14.0.jar:6.14.0]
      at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261) [wicket-core-6.14.0.jar:6.14.0]
      at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218) [wicket-core-6.14.0.jar:6.14.0]
      at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289) [wicket-core-6.14.0.jar:6.14.0]
      at org.apache.wicket.atmosphere.EventBus.post(EventBus.java:372) [wicket-atmosphere-0.16.jar:0.16]
      at org.apache.wicket.atmosphere.EventBus.postToSingleResource(EventBus.java:348) [wicket-atmosphere-0.16.jar:0.16]
      at org.apache.wicket.atmosphere.EventBus.post(EventBus.java:323) [wicket-atmosphere-0.16.jar:0.16]
      ...

      If you have got a component on a page with a public method that has a "Subscribe" annotation, the component / the path to the component gets registered to the corresponding page. But if you remove the component from the page the subscription does not get removed. A following atmosphere event could invoke this exception.

      As a workaround I added a null check in my own SubscribeAnnotationEventSubscriptionInvoker:

      public void invoke(AjaxRequestTarget target, EventSubscription subscription, Object base, AtmosphereEvent event, AjaxRequestInitializer ajaxRequestInitializer) {
      if (base != null)

      { ... }

      }

        Attachments

          Activity

            People

            • Assignee:
              papegaaij Emond Papegaaij
              Reporter:
              cwellekoetter Christian Wellek├Âtter
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: