提交 02949fc4 编写于 作者: R Rossen Stoyanchev

Fix failing tests

上级 b3c7c18c
...@@ -61,6 +61,7 @@ import org.springframework.messaging.support.converter.MessageConverter; ...@@ -61,6 +61,7 @@ import org.springframework.messaging.support.converter.MessageConverter;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.util.ClassUtils; import org.springframework.util.ClassUtils;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ReflectionUtils.MethodFilter; import org.springframework.util.ReflectionUtils.MethodFilter;
...@@ -270,11 +271,12 @@ public class AnnotationMethodMessageHandler implements MessageHandler, Applicati ...@@ -270,11 +271,12 @@ public class AnnotationMethodMessageHandler implements MessageHandler, Applicati
} }
private boolean checkDestinationPrefix(String destination) { private boolean checkDestinationPrefix(String destination) {
if ((destination != null) && (this.destinationPrefixes != null)) { if ((destination == null) || CollectionUtils.isEmpty(this.destinationPrefixes)) {
for (String prefix : this.destinationPrefixes) { return true;
if (destination.startsWith(prefix)) { }
return true; for (String prefix : this.destinationPrefixes) {
} if (destination.startsWith(prefix)) {
return true;
} }
} }
return false; return false;
......
...@@ -28,6 +28,7 @@ import org.springframework.messaging.simp.SimpMessageHeaderAccessor; ...@@ -28,6 +28,7 @@ import org.springframework.messaging.simp.SimpMessageHeaderAccessor;
import org.springframework.messaging.simp.SimpMessageType; import org.springframework.messaging.simp.SimpMessageType;
import org.springframework.messaging.support.MessageBuilder; import org.springframework.messaging.support.MessageBuilder;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.util.MultiValueMap; import org.springframework.util.MultiValueMap;
...@@ -103,11 +104,12 @@ public class SimpleBrokerMessageHandler implements MessageHandler { ...@@ -103,11 +104,12 @@ public class SimpleBrokerMessageHandler implements MessageHandler {
} }
private boolean checkDestinationPrefix(String destination) { private boolean checkDestinationPrefix(String destination) {
if ((destination != null) && (this.destinationPrefixes != null)) { if ((destination == null) || CollectionUtils.isEmpty(this.destinationPrefixes)) {
for (String prefix : this.destinationPrefixes) { return true;
if (destination.startsWith(prefix)) { }
return true; for (String prefix : this.destinationPrefixes) {
} if (destination.startsWith(prefix)) {
return true;
} }
} }
return false; return false;
......
...@@ -36,7 +36,7 @@ import static org.mockito.Mockito.*; ...@@ -36,7 +36,7 @@ import static org.mockito.Mockito.*;
* @author Rossen Stoyanchev * @author Rossen Stoyanchev
* @since 4.0 * @since 4.0
*/ */
public class SimpleBrokerWebMessageHandlerTests { public class SimpleBrokerMessageHandlerTests {
private SimpleBrokerMessageHandler messageHandler; private SimpleBrokerMessageHandler messageHandler;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册