Closed as not planned
Description
Hi Spring team,
While reading the source code of org.springframework.messaging.support.MessageHeaderAccessor, I noticed something that seems potentially unintended in the verifyType method:
protected void verifyType(@Nullable String headerName, @Nullable Object headerValue) {
if (headerName != null && headerValue != null) {
if (MessageHeaders.ERROR_CHANNEL.equals(headerName) ||
MessageHeaders.REPLY_CHANNEL.endsWith(headerName)) {
if (!(headerValue instanceof MessageChannel || headerValue instanceof String)) {
throw new IllegalArgumentException(
"'" + headerName + "' header value must be a MessageChannel or String");
}
}
}
}
My question is about the use of MessageHeaders.REPLY_CHANNEL.endsWith(headerName) — is this intended to be endsWith, or should it be equals, similar to how ERROR_CHANNEL is compared? Using endsWith might lead to false positives when the header name is a suffix of "replyChannel".
Could you please clarify if this is intentional or if it might be a bug?
Thanks for your great work!