Skip to content

Commit 02949fc

Browse files
committed
Fix failing tests
1 parent b3c7c18 commit 02949fc

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

spring-messaging/src/main/java/org/springframework/messaging/simp/handler/AnnotationMethodMessageHandler.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
import org.springframework.stereotype.Controller;
6262
import org.springframework.util.Assert;
6363
import org.springframework.util.ClassUtils;
64+
import org.springframework.util.CollectionUtils;
6465
import org.springframework.util.ReflectionUtils.MethodFilter;
6566

6667

@@ -270,11 +271,12 @@ private void handleMessageInternal(final Message<?> message, Map<MappingInfo, Ha
270271
}
271272

272273
private boolean checkDestinationPrefix(String destination) {
273-
if ((destination != null) && (this.destinationPrefixes != null)) {
274-
for (String prefix : this.destinationPrefixes) {
275-
if (destination.startsWith(prefix)) {
276-
return true;
277-
}
274+
if ((destination == null) || CollectionUtils.isEmpty(this.destinationPrefixes)) {
275+
return true;
276+
}
277+
for (String prefix : this.destinationPrefixes) {
278+
if (destination.startsWith(prefix)) {
279+
return true;
278280
}
279281
}
280282
return false;

spring-messaging/src/main/java/org/springframework/messaging/simp/handler/SimpleBrokerMessageHandler.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.springframework.messaging.simp.SimpMessageType;
2929
import org.springframework.messaging.support.MessageBuilder;
3030
import org.springframework.util.Assert;
31+
import org.springframework.util.CollectionUtils;
3132
import org.springframework.util.MultiValueMap;
3233

3334

@@ -103,11 +104,12 @@ else if (SimpMessageType.DISCONNECT.equals(messageType)) {
103104
}
104105

105106
private boolean checkDestinationPrefix(String destination) {
106-
if ((destination != null) && (this.destinationPrefixes != null)) {
107-
for (String prefix : this.destinationPrefixes) {
108-
if (destination.startsWith(prefix)) {
109-
return true;
110-
}
107+
if ((destination == null) || CollectionUtils.isEmpty(this.destinationPrefixes)) {
108+
return true;
109+
}
110+
for (String prefix : this.destinationPrefixes) {
111+
if (destination.startsWith(prefix)) {
112+
return true;
111113
}
112114
}
113115
return false;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
* @author Rossen Stoyanchev
3737
* @since 4.0
3838
*/
39-
public class SimpleBrokerWebMessageHandlerTests {
39+
public class SimpleBrokerMessageHandlerTests {
4040

4141
private SimpleBrokerMessageHandler messageHandler;
4242

0 commit comments

Comments
 (0)