Skip to content
Permalink
Browse files
ARTEMIS-3770 mitigate potential NPE
This was being triggered by
org.apache.activemq.artemis.tests.integration.routing.MQTTRedirectTest.
  • Loading branch information
jbertram authored and clebertsuconic committed May 10, 2022
1 parent bed9af2 commit 3a0658c202ebbbf43d0c96f934f84c7a1d98fa48
Showing 1 changed file with 7 additions and 3 deletions.
@@ -448,10 +448,14 @@ private boolean checkClientVersion() {
private void disconnectExistingSession(MQTTConnection existingConnection) {
if (existingConnection != null) {
MQTTSession existingSession = session.getProtocolManager().getSessionState(session.getConnection().getClientID()).getSession();
if (session.getVersion() == MQTTVersion.MQTT_5) {
existingSession.getProtocolHandler().sendDisconnect(MQTTReasonCodes.SESSION_TAKEN_OVER);
if (existingSession != null) {
if (session.getVersion() == MQTTVersion.MQTT_5) {
existingSession.getProtocolHandler().sendDisconnect(MQTTReasonCodes.SESSION_TAKEN_OVER);
}
existingSession.getConnectionManager().disconnect(false);
} else {
existingConnection.disconnect(false);
}
existingSession.getConnectionManager().disconnect(false);
}
}

0 comments on commit 3a0658c

Please sign in to comment.