Skip to content
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

Handled crash when subscribing to invalid topic #33

Merged

Conversation

hiteshchopra11
Copy link
Contributor

Fix for #32 (comment)

There is a crash when we try to connect to an invalid topic.
For example home# or home+

Steps to reproduce -:

  1. Connect to a MQTT broker
  2. Subscribe to an invalid topic name. Example home#

Error Logs -:

2022-07-16 13:45:37.778 10608-10647/com.gojek.courier.app E/AndroidRuntime: FATAL EXCEPTION: MQTT_Thread
    Process: com.gojek.courier.app, PID: 10608
    java.lang.IllegalArgumentException: Invalid usage of multi-level wildcard in topic string: home#
        at org.eclipse.paho.client.mqttv3.MqttTopic.validate(MqttTopic.java:200)
        at org.eclipse.paho.client.mqttv3.MqttAsyncClient.subscribe(MqttAsyncClient.java:889)
        at com.gojek.mqtt.connection.MqttConnection.subscribe(MqttConnection.kt:474)
        at com.gojek.mqtt.client.v3.impl.AndroidMqttClient.subscribeMqtt(AndroidMqttClient.kt:465)
        at com.gojek.mqtt.scheduler.runnable.SubscribeRunnable.run(SubscribeRunnable.kt:11)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.os.HandlerThread.run(HandlerThread.java:67)

Video for your reference

@deepanshu42 deepanshu42 merged commit 4d00828 into gojek:main Aug 9, 2022
@deepanshu42
Copy link
Collaborator

Closes #32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants