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 2019/03/02 21:50:42 UTC
[wicket] branch master updated: WICKET-6639
PageStoreManager$SessionEntry.clear produces NullPointerException
This is an automated email from the ASF dual-hosted git repository.
mgrigorov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/wicket.git
The following commit(s) were added to refs/heads/master by this push:
new 8fe2ef1 WICKET-6639 PageStoreManager$SessionEntry.clear produces NullPointerException
8fe2ef1 is described below
commit 8fe2ef1a799ef2e6ae6c56687077ac795caf98e1
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
AuthorDate: Sat Mar 2 23:50:16 2019 +0200
WICKET-6639 PageStoreManager$SessionEntry.clear produces NullPointerException
Add some checks for sessionCache being null
---
.../org/apache/wicket/page/PageStoreManager.java | 24 ++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/wicket-core/src/main/java/org/apache/wicket/page/PageStoreManager.java b/wicket-core/src/main/java/org/apache/wicket/page/PageStoreManager.java
index e1b543a..3e8daee 100644
--- a/wicket-core/src/main/java/org/apache/wicket/page/PageStoreManager.java
+++ b/wicket-core/src/main/java/org/apache/wicket/page/PageStoreManager.java
@@ -49,10 +49,10 @@ public class PageStoreManager extends AbstractPageManager
* Web containers intercept
* {@link javax.servlet.http.HttpSession#setAttribute(String, Object)} to detect changes and
* replicate the session. If the attribute has been already bound in the session then
- * {@link #valueUnbound(HttpSessionBindingEvent)} might get called - this flag
+ * {@link SessionEntry#valueUnbound(HttpSessionBindingEvent)} might get called - this flag
* helps us to ignore the invocation in that case.
*
- * @see #valueUnbound(HttpSessionBindingEvent)
+ * @see SessionEntry#valueUnbound(HttpSessionBindingEvent)
*/
private static final ThreadLocal<Boolean> STORING_TOUCHED_PAGES = new ThreadLocal<Boolean>()
{
@@ -149,11 +149,14 @@ public class PageStoreManager extends AbstractPageManager
*/
private IManageablePage findPage(int id)
{
- for (IManageablePage p : sessionCache)
+ if (sessionCache != null)
{
- if (p.getPageId() == id)
+ for (IManageablePage p : sessionCache)
{
- return p;
+ if (p.getPageId() == id)
+ {
+ return p;
+ }
}
}
return null;
@@ -173,6 +176,11 @@ public class PageStoreManager extends AbstractPageManager
return;
}
+ if (sessionCache == null)
+ {
+ sessionCache = new ArrayList<>();
+ }
+
sessionCache.add(page);
}
}
@@ -181,7 +189,11 @@ public class PageStoreManager extends AbstractPageManager
{
if (page != null)
{
- sessionCache.remove(page);
+ if (sessionCache != null)
+ {
+ sessionCache.remove(page);
+ }
+
final IPageStore pageStore = getPageStore();
if (pageStore != null)
{