Do match message type

SimpMessageTypeMessageCondition was lenient in matching the message
type, essentially matching on any non-null message type with an exact
match given a preference only in comparing mulitple matches.

This commit modifies matching logic to look for an exact match.

Issue: SPR-16109
This commit is contained in:
Rossen Stoyanchev
2017-11-01 08:59:24 -04:00
parent a58002a5de
commit 64bc9b4311
2 changed files with 10 additions and 8 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2017 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.
@@ -74,11 +74,8 @@ public class SimpMessageTypeMessageCondition extends AbstractMessageCondition<Si
@Override
@Nullable
public SimpMessageTypeMessageCondition getMatchingCondition(Message<?> message) {
Object actualMessageType = SimpMessageHeaderAccessor.getMessageType(message.getHeaders());
if (actualMessageType == null) {
return null;
}
return this;
SimpMessageType actual = SimpMessageHeaderAccessor.getMessageType(message.getHeaders());
return (actual != null && actual.equals(this.messageType) ? this : null);
}
@Override