Skip to content

Commit

Permalink
Fix wildcard option check in Subscribe message (crossbario#477)
Browse files Browse the repository at this point in the history
Check if the option is of allowed "wildcard" type instead of checking for "exact" twice.
  • Loading branch information
mrtnmch authored Mar 25, 2020
1 parent 331107e commit 15f27b9
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public Subscribe(long request, SubscribeOptions options, String topic) {
if (options != null) {
if (options.match != null) {
if (!options.match.equals(MATCH_EXACT) && !options.match.equals(MATCH_PREFIX) &&
!options.match.equals(MATCH_EXACT)) {
!options.match.equals(MATCH_WILDCARD)) {
throw new IllegalArgumentException("match must be one of exact, prefix or wildcard.");
}
}
Expand All @@ -65,7 +65,7 @@ public static Subscribe parse(List<Object> wmsg) {
if (options.containsKey("match")) {
match = (String) options.get("match");
if (!match.equals(MATCH_EXACT) && !match.equals(MATCH_PREFIX) &&
!match.equals(MATCH_EXACT)) {
!match.equals(MATCH_WILDCARD)) {
throw new ProtocolError("match must be one of exact, prefix or wildcard.");
}
}
Expand Down

0 comments on commit 15f27b9

Please sign in to comment.