You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by vi...@apache.org on 2013/07/03 21:35:39 UTC
svn commit: r1499534 -
/tomcat/trunk/java/org/apache/tomcat/websocket/server/WsServerContainer.java
Author: violetagg
Date: Wed Jul 3 19:35:38 2013
New Revision: 1499534
URL: http://svn.apache.org/r1499534
Log:
Avoid NPE when a background thread tries to expire the HTTP sessions.
Modified:
tomcat/trunk/java/org/apache/tomcat/websocket/server/WsServerContainer.java
Modified: tomcat/trunk/java/org/apache/tomcat/websocket/server/WsServerContainer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/server/WsServerContainer.java?rev=1499534&r1=1499533&r2=1499534&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/server/WsServerContainer.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/server/WsServerContainer.java Wed Jul 3 19:35:38 2013
@@ -367,12 +367,14 @@ public class WsServerContainer extends W
public void closeAuthenticatedSession(String httpSessionId) {
Set<WsSession> wsSessions = authenticatedSessions.remove(httpSessionId);
- for (WsSession wsSession : wsSessions) {
- try {
- wsSession.close(AUTHENTICATED_HTTP_SESSION_CLOSED);
- } catch (IOException e) {
- // Any IOExceptions during close will have been caught and the
- // onError method called.
+ if (wsSessions != null && !wsSessions.isEmpty()) {
+ for (WsSession wsSession : wsSessions) {
+ try {
+ wsSession.close(AUTHENTICATED_HTTP_SESSION_CLOSED);
+ } catch (IOException e) {
+ // Any IOExceptions during close will have been caught and the
+ // onError method called.
+ }
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org