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: [email protected]
For additional commands, e-mail: [email protected]