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

Misleading error message when connecting to an MQTT 3 only broker with MQTT 5 #327

Closed
ahelmbr opened this issue Sep 20, 2019 · 1 comment · Fixed by #375
Closed

Misleading error message when connecting to an MQTT 3 only broker with MQTT 5 #327

ahelmbr opened this issue Sep 20, 2019 · 1 comment · Fixed by #375

Comments

@ahelmbr
Copy link

ahelmbr commented Sep 20, 2019

Expected behavior

Handle error with a better exception

Actual behavior

Anjas-MacBook-Pro:hivemq-cli ahelmbre$ java -jar build/libs/mqtt-cli-1.0.0.jar pub -pw test -u anja -t test -m ";2Cmessage" -i test -d 
Client test: sending CONNECT
Client test: com.hivemq.client.mqtt.mqtt5.exceptions.Mqtt5DisconnectException: Exception while decoding CONNACK: remaining length too short
	at com.hivemq.client.internal.mqtt.MqttBlockingClient.connect(MqttBlockingClient.java:91)
	at com.hivemq.cli.mqtt.MqttClientExecutor.mqtt5Connect(MqttClientExecutor.java:79)
	at com.hivemq.cli.mqtt.AbstractMqttClientExecutor.connectMqtt5Client(AbstractMqttClientExecutor.java:238)
	at com.hivemq.cli.mqtt.AbstractMqttClientExecutor.connect(AbstractMqttClientExecutor.java:201)
	at com.hivemq.cli.mqtt.MqttClientExecutor.connect(MqttClientExecutor.java:62)
	at com.hivemq.cli.mqtt.AbstractMqttClientExecutor.getMqttClientFromCacheOrConnect(AbstractMqttClientExecutor.java:432)
	at com.hivemq.cli.mqtt.AbstractMqttClientExecutor.publish(AbstractMqttClientExecutor.java:110)
	at com.hivemq.cli.mqtt.MqttClientExecutor.publish(MqttClientExecutor.java:62)
	at com.hivemq.cli.commands.cli.PublishCommand.run(PublishCommand.java:109)
	at picocli.CommandLine.executeUserObject(CommandLine.java:1729)
	at picocli.CommandLine.access$900(CommandLine.java:145)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2101)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2068)
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:1935)
	at picocli.CommandLine.execute(CommandLine.java:1864)
	at com.hivemq.cli.MqttCLIMain.main(MqttCLIMain.java:72)
Caused by: com.hivemq.client.mqtt.exceptions.MqttDecodeException: Exception while decoding CONNACK: remaining length too short
Client test: Exception while decoding CONNACK: remaining length too short

To Reproduce

  • try to publish with an Mqtt 5 Client
  • broker is set to a mosquitto broker

Steps

Reproducer code

Details

  • Affected HiveMQ MQTT Client version(s): 1.1.2
  • Used JVM version:1.8
@SgtSilvio
Copy link
Member

The mosquitto broker is an old version which only supports MQTT 3.
The ConnAck is then an MQTT 3 ConnAck which has a shorter length (2) than MQTT 5 (3).

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

Successfully merging a pull request may close this issue.

2 participants