You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2014/03/25 16:29:24 UTC
git commit: WICKET-5541 NullPointerException in
SubscribeAnnotationEventSubscriptionInvoker on remove of component from page
Repository: wicket
Updated Branches:
refs/heads/master dbf8c28c4 -> d04a4528c
WICKET-5541 NullPointerException in SubscribeAnnotationEventSubscriptionInvoker on remove of component from page
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/d04a4528
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/d04a4528
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/d04a4528
Branch: refs/heads/master
Commit: d04a4528c8e427b79ad0a538586f740a37e6999c
Parents: dbf8c28
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Tue Mar 25 16:29:04 2014 +0100
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Tue Mar 25 16:29:04 2014 +0100
----------------------------------------------------------------------
.../atmosphere/AtmosphereRequestHandler.java | 35 +++++++++++++++-----
1 file changed, 26 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/d04a4528/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/AtmosphereRequestHandler.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/AtmosphereRequestHandler.java b/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/AtmosphereRequestHandler.java
index 26ffa99..e87d2b8 100644
--- a/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/AtmosphereRequestHandler.java
+++ b/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/AtmosphereRequestHandler.java
@@ -26,6 +26,8 @@ import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.request.IRequestCycle;
import org.apache.wicket.request.IRequestHandler;
import org.apache.wicket.request.cycle.RequestCycle;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Handles pseudo requests triggered by an event. An {@link AjaxRequestTarget} is scheduled and the
@@ -35,13 +37,15 @@ import org.apache.wicket.request.cycle.RequestCycle;
*/
public class AtmosphereRequestHandler implements IRequestHandler
{
- private PageKey pageKey;
+ private static final Logger LOGGER = LoggerFactory.getLogger(AtmosphereRequestHandler.class);
- private AtmosphereEvent event;
+ private final PageKey pageKey;
- private Collection<EventSubscription> subscriptions;
+ private final AtmosphereEvent event;
- private EventSubscriptionInvoker eventSubscriptionInvoker;
+ private final Collection<EventSubscription> subscriptions;
+
+ private final EventSubscriptionInvoker eventSubscriptionInvoker;
private boolean ajaxRequestScheduled = false;
@@ -76,12 +80,25 @@ public class AtmosphereRequestHandler implements IRequestHandler
{
if (curSubscription.getContextAwareFilter().apply(event))
{
- Component component = page.get(curSubscription.getComponentPath());
- if (curSubscription.getBehaviorIndex() == null)
- invokeMethod(target, curSubscription, component);
+ String componentPath = curSubscription.getComponentPath();
+ Component component = page.get(componentPath);
+ if (component != null)
+ {
+ if (curSubscription.getBehaviorIndex() == null)
+ {
+ invokeMethod(target, curSubscription, component);
+ }
+ else
+ {
+ invokeMethod(target, curSubscription,
+ component.getBehaviorById(curSubscription.getBehaviorIndex()));
+ }
+ }
else
- invokeMethod(target, curSubscription,
- component.getBehaviorById(curSubscription.getBehaviorIndex()));
+ {
+ LOGGER.debug("Cannot find component with path '{}' in page '{}'. Maybe it has been removed already.",
+ componentPath, page);
+ }
}
}
}