ARTEMIS-1952 NPE logged at warn if MQTT subscriber disconnects abruptly

Prevent a NullPointerException if no connection by the given clientId is
found on the cache of stored sessions
This commit is contained in:
Otavio R. Piske 2019-02-21 19:33:07 +01:00
parent 951a061555
commit 16909584c3
1 changed files with 7 additions and 1 deletions

View File

@ -179,7 +179,13 @@ class MQTTProtocolManager extends AbstractProtocolManager<MqttMessage, MQTTInter
}
public boolean isClientConnected(String clientId, MQTTConnection connection) {
return connectedClients.get(clientId).equals(connection);
MQTTConnection connectedConn = connectedClients.get(clientId);
if (connectedConn != null) {
return connectedConn.equals(connection);
}
return false;
}
public void removeConnectedClient(String clientId) {