-
Notifications
You must be signed in to change notification settings - Fork 1.1k
GH-8720: Check MQTT topics if not empty strings #8722
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I'll back-port to |
@@ -277,7 +286,7 @@ public void addTopic(String topic, int qos) { | |||
*/ | |||
@ManagedOperation | |||
public void addTopic(String... topic) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency use the plural naming: topic
-> topics
.
@@ -298,8 +307,7 @@ public void addTopic(String... topic) { | |||
*/ | |||
@ManagedOperation | |||
public void addTopics(String[] topic, int[] qos) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same, for consistency use the plural naming: topic
-> topics
.
if (topic == null && this.defaultTopic == null) { | ||
throw new IllegalStateException( | ||
"No topic could be determined from the message and no default topic defined"); | ||
if (topic == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the topic
be returned as an empty string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The MQTT client validates the topic before publishing.
And that is done in a sync mode, so even if it is returned here as empty, it is going to be reject immediately in that publish()
implementations.
Fixes spring-projects#8720 Validate MQTT topics for empty strings in the channel adapters configuration **Cherry-pick to `6.1.x` & `6.0.x`**
Back-ported to |
Fixes #8720
Validate MQTT topics for empty strings in the channel adapters configuration
Cherry-pick to
6.1.x
&6.0.x