Clean up warnings in spring-messaging
This commit is contained in:
@@ -56,7 +56,6 @@ public abstract class AbstractMessageReceivingTemplate<D> extends AbstractMessag
|
||||
return receiveAndConvert(getRequiredDefaultDestination(), targetClass);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T> T receiveAndConvert(D destination, Class<T> targetClass) {
|
||||
Message<?> message = doReceive(destination);
|
||||
|
||||
@@ -43,7 +43,6 @@ import org.springframework.messaging.handler.HandlerMethod;
|
||||
import org.springframework.messaging.handler.HandlerMethodSelector;
|
||||
import org.springframework.messaging.support.MessageBuilder;
|
||||
import org.springframework.messaging.support.MessageHeaderAccessor;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
|
||||
@@ -189,7 +189,7 @@ public class SimpMessageHeaderAccessor extends NativeMessageHeaderAccessor {
|
||||
sb.append(" attributes=").append(getSessionAttributes());
|
||||
}
|
||||
if (!CollectionUtils.isEmpty((Map<String, List<String>>) getHeader(NATIVE_HEADERS))) {
|
||||
sb.append(" nativeHeaders=").append((Map<String, List<String>>) getHeader(NATIVE_HEADERS));
|
||||
sb.append(" nativeHeaders=").append(getHeader(NATIVE_HEADERS));
|
||||
}
|
||||
sb.append(getDetailedPayloadLogMessage(payload));
|
||||
return sb.toString();
|
||||
|
||||
@@ -144,7 +144,6 @@ public class SimpMessagingTemplate extends AbstractMessageSendingTemplate<String
|
||||
doSend(getRequiredDefaultDestination(), message);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
protected void doSend(String destination, Message<?> message) {
|
||||
Assert.notNull(destination, "Destination must not be null");
|
||||
|
||||
@@ -42,7 +42,6 @@ import org.springframework.messaging.support.AbstractSubscribableChannel;
|
||||
import org.springframework.messaging.support.ExecutorSubscribableChannel;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.MimeTypeUtils;
|
||||
import org.springframework.util.PathMatcher;
|
||||
import org.springframework.validation.Errors;
|
||||
|
||||
@@ -733,7 +733,7 @@ public class StompBrokerRelayMessageHandler extends AbstractBrokerMessageHandler
|
||||
if (this.isRemoteClientSession) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("TCP connection closed already, ignoring " +
|
||||
accessor.getShortLogMessage((byte[]) message.getPayload()));
|
||||
accessor.getShortLogMessage(message.getPayload()));
|
||||
}
|
||||
return EMPTY_TASK;
|
||||
}
|
||||
|
||||
@@ -555,7 +555,6 @@ public class MessageHeaderAccessor {
|
||||
* @return an accessor instance of the specified type, or {@code null} if none
|
||||
* @since 4.1
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T extends MessageHeaderAccessor> T getAccessor(Message<?> message, Class<T> requiredType) {
|
||||
return getAccessor(message.getHeaders(), requiredType);
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ import reactor.tuple.Tuple2;
|
||||
*/
|
||||
public class Reactor11TcpClient<P> implements TcpOperations<P> {
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static final Class<NettyTcpClient> REACTOR_TCP_CLIENT_TYPE = NettyTcpClient.class;
|
||||
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageHeaders;
|
||||
@@ -42,13 +41,7 @@ import static org.junit.Assert.*;
|
||||
*/
|
||||
public class MessageConverterTests {
|
||||
|
||||
private TestMessageConverter converter;
|
||||
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
this.converter = new TestMessageConverter();
|
||||
}
|
||||
private TestMessageConverter converter = new TestMessageConverter();
|
||||
|
||||
@Test
|
||||
public void supportsTargetClass() {
|
||||
@@ -105,7 +98,6 @@ public class MessageConverterTests {
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void setStrictContentTypeMatchWithNoSupportedMimeTypes() {
|
||||
Message<String> message = MessageBuilder.withPayload("ABC").build();
|
||||
this.converter = new TestMessageConverter(Collections.<MimeType>emptyList());
|
||||
this.converter.setStrictContentTypeMatch(true);
|
||||
}
|
||||
|
||||
@@ -130,6 +130,7 @@ public class MethodMessageHandlerTests {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class TestController {
|
||||
|
||||
public String method;
|
||||
@@ -140,6 +141,7 @@ public class MethodMessageHandlerTests {
|
||||
this.method = "pathMatchWildcard";
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void handlerArgumentResolver(Message message) {
|
||||
this.method = "handlerArgumentResolver";
|
||||
this.arguments.put("message", message);
|
||||
@@ -164,6 +166,7 @@ public class MethodMessageHandlerTests {
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class DuplicateMappingsController {
|
||||
|
||||
public void handlerFoo() { }
|
||||
|
||||
@@ -39,6 +39,7 @@ public class SimpSessionScopeTests {
|
||||
|
||||
private SimpSessionScope scope;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private ObjectFactory objectFactory;
|
||||
|
||||
private SimpAttributes simpAttributes;
|
||||
|
||||
@@ -78,7 +78,6 @@ public class SendToMethodReturnValueHandlerTests {
|
||||
|
||||
|
||||
@Before
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void setup() throws Exception {
|
||||
|
||||
MockitoAnnotations.initMocks(this);
|
||||
|
||||
@@ -87,6 +87,7 @@ public class SimpAnnotationMethodMessageHandlerTests {
|
||||
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void headerArgumentResolution() {
|
||||
SimpMessageHeaderAccessor headers = SimpMessageHeaderAccessor.create();
|
||||
headers.setSessionId("session1");
|
||||
|
||||
@@ -124,8 +124,8 @@ public class SubscriptionMethodReturnValueHandlerTests {
|
||||
assertEquals(MIME_TYPE, headerAccessor.getContentType());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void testHeadersPassedToMessagingTemplate() throws Exception {
|
||||
|
||||
String sessionId = "sess1";
|
||||
|
||||
@@ -32,7 +32,6 @@ import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.junit.rules.TestName;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
@@ -386,6 +385,8 @@ public class StompBrokerRelayMessageHandlerIntegrationTests {
|
||||
return builder;
|
||||
}
|
||||
|
||||
// TODO Determine why connectWithError() is unused.
|
||||
@SuppressWarnings("unused")
|
||||
public static MessageExchangeBuilder connectWithError(String sessionId) {
|
||||
StompHeaderAccessor headers = StompHeaderAccessor.create(StompCommand.CONNECT);
|
||||
headers.setSessionId(sessionId);
|
||||
|
||||
@@ -225,6 +225,8 @@ public class ExecutorSubscribableChannelTests {
|
||||
this.messageToReturn = messageToReturn;
|
||||
}
|
||||
|
||||
// TODO Determine why setExceptionToRaise() is unused.
|
||||
@SuppressWarnings("unused")
|
||||
public void setExceptionToRaise(RuntimeException exception) {
|
||||
this.exceptionToRaise = exception;
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ public class MessageBuilderTests {
|
||||
@Test
|
||||
public void testBuildMultipleMessages() {
|
||||
MessageHeaderAccessor headerAccessor = new MessageHeaderAccessor();
|
||||
MessageBuilder messageBuilder = MessageBuilder.withPayload("payload").setHeaders(headerAccessor);
|
||||
MessageBuilder<?> messageBuilder = MessageBuilder.withPayload("payload").setHeaders(headerAccessor);
|
||||
|
||||
headerAccessor.setHeader("foo", "bar1");
|
||||
Message<?> message1 = messageBuilder.build();
|
||||
|
||||
@@ -85,7 +85,6 @@ public class NativeMessageHeaderAccessorTests {
|
||||
Map<String, Object> actual = headerAccessor.toMap();
|
||||
assertEquals(0, actual.size());
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, List<String>> actualNativeHeaders = headerAccessor.toNativeHeaderMap();
|
||||
assertEquals(Collections.emptyMap(), actualNativeHeaders);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user