You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Christian Wellekötter (JIRA)" <ji...@apache.org> on 2014/03/24 15:03:44 UTC

[jira] [Updated] (WICKET-5541) NullPointerException in SubscribeAnnotationEventSubscriptionInvoker on remove of component from page

     [ https://issues.apache.org/jira/browse/WICKET-5541?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christian Wellekötter updated WICKET-5541:
------------------------------------------

    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) {
...
        }
}


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

{code}
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]
...
{code}

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:

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

{code}


> NullPointerException in SubscribeAnnotationEventSubscriptionInvoker on remove of component from page
> ----------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-5541
>                 URL: https://issues.apache.org/jira/browse/WICKET-5541
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-atmosphere
>    Affects Versions: 6.14.0
>            Reporter: Christian Wellekötter
>            Assignee: Emond Papegaaij
>
> 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) {
> ...
>         }
> }



--
This message was sent by Atlassian JIRA
(v6.2#6252)