diff options
author | Leif Åstrand <leif@vaadin.com> | 2012-09-18 13:47:32 +0300 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2012-09-18 13:47:32 +0300 |
commit | efb7fc901d0aaa0e87f529c8dc1a2442cfd3ea70 (patch) | |
tree | acc05027f2e710c46f5ffd99790d6d98bbeeb3ee | |
parent | 41c0e015c48079c60d1a37d8bdecf9c55a821191 (diff) | |
download | vaadin-framework-efb7fc901d0aaa0e87f529c8dc1a2442cfd3ea70.tar.gz vaadin-framework-efb7fc901d0aaa0e87f529c8dc1a2442cfd3ea70.zip |
Add null checks when wrapping session (#9655)
-rw-r--r-- | server/src/com/vaadin/server/WrappedHttpServletRequest.java | 8 | ||||
-rw-r--r-- | server/src/com/vaadin/server/WrappedPortletRequest.java | 10 |
2 files changed, 15 insertions, 3 deletions
diff --git a/server/src/com/vaadin/server/WrappedHttpServletRequest.java b/server/src/com/vaadin/server/WrappedHttpServletRequest.java index adfbde87ef..99e8881ec1 100644 --- a/server/src/com/vaadin/server/WrappedHttpServletRequest.java +++ b/server/src/com/vaadin/server/WrappedHttpServletRequest.java @@ -18,6 +18,7 @@ package com.vaadin.server; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequestWrapper; +import javax.servlet.http.HttpSession; import com.vaadin.server.VaadinServlet.ServletService; @@ -61,7 +62,12 @@ public class WrappedHttpServletRequest extends HttpServletRequestWrapper @Override public WrappedSession getWrappedSession(boolean allowSessionCreation) { - return new WrappedHttpSession(getSession(allowSessionCreation)); + HttpSession session = getSession(allowSessionCreation); + if (session != null) { + return new WrappedHttpSession(session); + } else { + return null; + } } /** diff --git a/server/src/com/vaadin/server/WrappedPortletRequest.java b/server/src/com/vaadin/server/WrappedPortletRequest.java index 78bfe838b1..d4670cfd92 100644 --- a/server/src/com/vaadin/server/WrappedPortletRequest.java +++ b/server/src/com/vaadin/server/WrappedPortletRequest.java @@ -23,6 +23,7 @@ import java.util.Map; import javax.portlet.ClientDataRequest; import javax.portlet.PortletRequest; +import javax.portlet.PortletSession; import javax.portlet.ResourceRequest; import com.vaadin.server.VaadinPortlet.PortletService; @@ -119,8 +120,13 @@ public class WrappedPortletRequest implements WrappedRequest { @Override public WrappedSession getWrappedSession(boolean allowSessionCreation) { - return new WrappedPortletSession( - request.getPortletSession(allowSessionCreation)); + PortletSession session = request + .getPortletSession(allowSessionCreation); + if (session != null) { + return new WrappedPortletSession(session); + } else { + return null; + } } /** |