fusesource / mqtt-client

A Java MQTT Client
http://mqtt-client.fusesource.org/
Apache License 2.0
1.27k stars 368 forks source link

MqttTopic isMatched method, some case result is not correct. #125

Open wangdaowangdao opened 4 years ago

wangdaowangdao commented 4 years ago

image image

  1. As shown above, I think topicFilter should match topicName, but isMatched method returns false.

topicFilter = finance/stock/+/# topicName = finance/stock/ibm isMatched = false

image image

  1. In this case, isMatched' method is right.

topicFilter = finance/stock/+ topicName = finance/stock/ibm isMatched = true

  1. As shown above, i found if topicFilter' length is longer than topicName's length and topicFilter contains "+" and "#", the result is always false, even if the topicFiler except for "#" match topicName.