INT-3626: More Sonar Fixes
JIRA: https://jira.spring.io/browse/INT-3626 Remove Direct Array Usages. With the increased use of java configuration and DSL, it is no longer safe to directly use array arguments. (Except in simple wrapper objects). Avoid (or mark //NOSONAR) catch Throwable. Remove unused field.
This commit is contained in:
@@ -123,16 +123,20 @@ public abstract class IntegrationWebSocketContainer implements DisposableBean {
|
||||
|
||||
@Override
|
||||
public void destroy() throws Exception {
|
||||
// Notify sessions to stop flushing messages
|
||||
for (WebSocketSession session : this.sessions.values()) {
|
||||
try {
|
||||
session.close(CloseStatus.GOING_AWAY);
|
||||
}
|
||||
catch (Throwable t) {
|
||||
logger.error("Failed to close session id '" + session.getId() + "': " + t.getMessage());
|
||||
try {
|
||||
// Notify sessions to stop flushing messages
|
||||
for (WebSocketSession session : this.sessions.values()) {
|
||||
try {
|
||||
session.close(CloseStatus.GOING_AWAY);
|
||||
}
|
||||
catch (Exception e) {
|
||||
logger.error("Failed to close session id '" + session.getId() + "': " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
this.sessions.clear();
|
||||
finally {
|
||||
this.sessions.clear();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
/*
|
||||
* Copyright 2014-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.websocket;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.springframework.scheduling.TaskScheduler;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
@@ -23,6 +40,7 @@ import org.springframework.web.socket.sockjs.transport.TransportHandler;
|
||||
* implementation of this class.
|
||||
*
|
||||
* @author Artem Bilan
|
||||
* @author Gary Russell
|
||||
* @since 4.1
|
||||
*/
|
||||
public class ServerWebSocketContainer extends IntegrationWebSocketContainer implements WebSocketConfigurer {
|
||||
@@ -45,7 +63,7 @@ public class ServerWebSocketContainer extends IntegrationWebSocketContainer impl
|
||||
}
|
||||
|
||||
public ServerWebSocketContainer setInterceptors(HandshakeInterceptor[] interceptors) {
|
||||
this.interceptors = interceptors;
|
||||
this.interceptors = Arrays.copyOf(interceptors, interceptors.length);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user