eclipse-paho / eclipse-paho/paho.mqtt.java
NPE on MqttConnectionOptions#setPassword(null) starting at v.1.2.1
- 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
Assessment
This issue has not been assessed yet.