eclipse-paho / eclipse-paho/paho.mqtt.java

NPE on MqttConnectionOptions#setPassword(null) starting at v.1.2.1

Open
#804 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.3k
Forks
919
PR merge metrics
No merged PRs in 30d

Description

- [X ] Bug exists Release Version 1.2.1 ( Master Branch)
- [X ] Bug exists in MQTTv3 Client on Snapshot Version 1.2.6-SNAPSHOT (Develop Branch)

* Expected behavior: `MqttConnectionOptions#setPassword(null)` passes (normal use case for unauthenticated connections)
* Actual behavior up to v.1.2.0: `MqttConnectionOptions#setPassword(null)` passes - normal
* Actual behavior starting with v1.2.1: `MqttConnectionOptions#setPassword(null)` breaks with NPE

Root cause: change from [this.password = password;](https://github.com/eclipse/paho.mqtt.java/blob/v1.2.0/org.eclipse.paho.client.mqttv3/src/main/java/org/eclipse/paho/client/mqttv3/MqttConnectOptions.java#L115) to [this.password = password.clone();](https://github.com/eclipse/paho.mqtt.java/blob/v1.2.1/org.eclipse.paho.client.mqttv3/src/main/java/org/eclipse/paho/client/mqttv3/MqttConnectOptions.java#L116) without introducing a null check.

This breaks existing applications.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.