This is an automated email from the ASF dual-hosted git repository. jbertram pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
The following commit(s) were added to refs/heads/main by this push: new 2fd0e96ed9 ARTEMIS-5575 fix potential NPE during MQTT link stealing 2fd0e96ed9 is described below commit 2fd0e96ed93b20d53b0a9dac1921048e9fbd80ab Author: Justin Bertram <jbert...@apache.org> AuthorDate: Fri Jul 11 14:02:33 2025 -0500 ARTEMIS-5575 fix potential NPE during MQTT link stealing This is a straight-forward fix for a race condition between checking if the key exists in the map and then fetching the value of that key. There's no test with this fix. Existing tests provide sufficient coverage. --- .../activemq/artemis/core/protocol/mqtt/MQTTProtocolHandler.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTProtocolHandler.java b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTProtocolHandler.java index 447295c229..f0a75a7302 100644 --- a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTProtocolHandler.java +++ b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTProtocolHandler.java @@ -478,8 +478,8 @@ public class MQTTProtocolHandler extends ChannelInboundHandlerAdapter { final String clientID = session.getConnection().getClientID(); LinkStealingResult result; - if (protocolManager.getStateManager().isClientConnected(clientID)) { - MQTTConnection existingConnection = protocolManager.getStateManager().getConnectedClient(clientID); + MQTTConnection existingConnection = protocolManager.getStateManager().getConnectedClient(clientID); + if (existingConnection != null) { if (protocolManager.isAllowLinkStealing()) { MQTTSession existingSession = protocolManager.getStateManager().getSessionState(clientID).getSession(); if (existingSession != null) { --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@activemq.apache.org For additional commands, e-mail: commits-h...@activemq.apache.org For further information, visit: https://activemq.apache.org/contact