Fix Sonar vulnerabilities for varargs

* Fix smell for static `AmqpInboundGateway.attributesHolder`

* Fix readOnlyHeaders in the `MessageBuilder`
This commit is contained in:
Artem Bilan
2019-05-29 12:45:06 -04:00
committed by Gary Russell
parent 1d08d3bdc2
commit 315f0e711f
18 changed files with 186 additions and 166 deletions

View File

@@ -16,6 +16,8 @@
package org.springframework.integration.stomp;
import java.util.Arrays;
import org.springframework.messaging.simp.stomp.StompSession;
import org.springframework.messaging.simp.stomp.StompSessionHandler;
import org.springframework.util.Assert;
@@ -29,8 +31,9 @@ import org.springframework.web.socket.messaging.WebSocketStompClient;
* @author Artem Bilan
* @author Sean Mills
*
* @see WebSocketStompClient
* @since 4.2
*
* @see WebSocketStompClient
*/
public class WebSocketStompSessionManager extends AbstractStompSessionManager {
@@ -44,7 +47,7 @@ public class WebSocketStompSessionManager extends AbstractStompSessionManager {
super(webSocketStompClient);
Assert.hasText(url, "'url' must not be empty.");
this.url = url;
this.uriVariables = uriVariables;
this.uriVariables = uriVariables != null ? Arrays.copyOf(uriVariables, uriVariables.length) : null;
}
public void setHandshakeHeaders(WebSocketHttpHeaders handshakeHeaders) {
@@ -53,8 +56,8 @@ public class WebSocketStompSessionManager extends AbstractStompSessionManager {
@Override
protected ListenableFuture<StompSession> doConnect(StompSessionHandler handler) {
return ((WebSocketStompClient) this.stompClient).connect(this.url, this.handshakeHeaders, getConnectHeaders(),
handler, this.uriVariables);
return ((WebSocketStompClient) this.stompClient)
.connect(this.url, this.handshakeHeaders, getConnectHeaders(), handler, this.uriVariables);
}
}