UNOMI-90 Empty sessionId is processed as a valid sessionId instead of being ignored.
Signed-off-by: Serge Huber <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/94b6af7f Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/94b6af7f Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/94b6af7f Branch: refs/heads/feature-UNOMI-5-KARAF4 Commit: 94b6af7fa60c117f6b899802c375257f04e6d460 Parents: 91d74da Author: Serge Huber <[email protected]> Authored: Tue Apr 4 13:05:28 2017 +0200 Committer: Serge Huber <[email protected]> Committed: Tue Apr 4 13:05:38 2017 +0200 ---------------------------------------------------------------------- wab/src/main/java/org/apache/unomi/web/ContextServlet.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/94b6af7f/wab/src/main/java/org/apache/unomi/web/ContextServlet.java ---------------------------------------------------------------------- diff --git a/wab/src/main/java/org/apache/unomi/web/ContextServlet.java b/wab/src/main/java/org/apache/unomi/web/ContextServlet.java index d3e29fe..a9ef4ef 100644 --- a/wab/src/main/java/org/apache/unomi/web/ContextServlet.java +++ b/wab/src/main/java/org/apache/unomi/web/ContextServlet.java @@ -158,7 +158,7 @@ public class ContextServlet extends HttpServlet { } } - if (sessionId != null) { + if (sessionId != null && sessionId.trim().length() > 0) { session = profileService.loadSession(sessionId, timestamp); if (session != null) { sessionProfile = session.getProfile(); @@ -199,8 +199,8 @@ public class ContextServlet extends HttpServlet { sessionProfile = privacyService.isRequireAnonymousBrowsing(profile.getItemId()) ? privacyService.getAnonymousProfile(profile) : profile; session = new Session(sessionId, sessionProfile, timestamp, scope); - if (sessionId != null) { - // Only save session and send event if a session id was provided, otherise keep transient session + if (sessionId != null && sessionId.trim().length() > 0) { + // Only save session and send event if a session id was provided, otherwise keep transient session changes |= EventService.SESSION_UPDATED; Event event = new Event("sessionCreated", session, profile, scope, null, session, timestamp); if (sessionProfile.isAnonymousProfile()) {
