eclipse / paho.mqtt.java

Eclipse Paho Java MQTT client library. Paho is an Eclipse IoT project.
https://eclipse.org/paho
Other
2.11k stars 882 forks source link

v5 1.2.5 subscript method self calling #917

Open ElisaMin opened 2 years ago

ElisaMin commented 2 years ago
java.lang.StackOverflowError
    at org.eclipse.paho.mqttv5.client.MqttClient.subscribe(MqttClient.java:525)
    at org.eclipse.paho.mqttv5.client.MqttClient.subscribe(MqttClient.java:525)
    at org.eclipse.paho.mqttv5.client.MqttClient.subscribe(MqttClient.java:525)
    at org.eclipse.paho.mqttv5.client.MqttClient.subscribe(MqttClient.java:525)
    at org.eclipse.paho.mqttv5.client.MqttClient.subscribe(MqttClient.java:525)
    at org.eclipse.paho.mqttv5.client.MqttClient.subscribe(MqttClient.java:525)
wattsec commented 2 years ago

It looks there is a bug in org.eclipse.paho.mqttv5.client.MqttClient where :

public IMqttToken subscribe(String[] topicFilters, int[] qos, IMqttMessageListener[] messageListeners) throws MqttException {
    return this.subscribe(topicFilters, qos, messageListeners);
}

Should be something like:

public IMqttToken subscribe(String[] topicFilters, int[] qos, IMqttMessageListener[] messageListeners) throws MqttException {
    IMqttToken tok = aClient.subscribe(topicFilters, qos, null, messageListeners);
    tok.waitForCompletion(getTimeToWait());
    return tok;
}
inad9300 commented 2 years ago

Any chance of seeing this bug fixed?