You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2019/02/21 20:04:50 UTC
[activemq-artemis] branch master updated: ARTEMIS-1952 NPE logged
at warn if MQTT subscriber disconnects abruptly
This is an automated email from the ASF dual-hosted git repository.
clebertsuconic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
The following commit(s) were added to refs/heads/master by this push:
new 1690958 ARTEMIS-1952 NPE logged at warn if MQTT subscriber disconnects abruptly
new fead3e2 This closes #2560
1690958 is described below
commit 16909584c336b6e5a58434629494be6ca7477b52
Author: Otavio R. Piske <an...@gmail.com>
AuthorDate: Thu Feb 21 19:33:07 2019 +0100
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
---
.../activemq/artemis/core/protocol/mqtt/MQTTProtocolManager.java | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTProtocolManager.java b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTProtocolManager.java
index c8832ba..71d30d8 100644
--- a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTProtocolManager.java
+++ b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTProtocolManager.java
@@ -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) {