From 66c63c374b8be03f765a84a386932920e6580402 Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Fri, 9 May 2014 11:54:55 -0400 Subject: [PATCH] Ensure handshake attrs are copied in SockJS session --- .../sockjs/transport/session/AbstractSockJsSession.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/session/AbstractSockJsSession.java b/spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/session/AbstractSockJsSession.java index 245279387d..215a69f6c3 100644 --- a/spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/session/AbstractSockJsSession.java +++ b/spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/session/AbstractSockJsSession.java @@ -25,6 +25,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ScheduledFuture; import org.apache.commons.logging.Log; @@ -94,7 +95,7 @@ public abstract class AbstractSockJsSession implements SockJsSession { private final WebSocketHandler handler; - private final Map attributes; + private final Map attributes = new ConcurrentHashMap(); private volatile State state = State.NEW; @@ -129,7 +130,10 @@ public abstract class AbstractSockJsSession implements SockJsSession { this.id = id; this.config = config; this.handler = handler; - this.attributes = attributes; + + if (attributes != null) { + this.attributes.putAll(attributes); + } }