Repository: activemq-artemis Updated Branches: refs/heads/2.6.x fd303af82 -> 19998d310
ARTEMIS-2098 potential NPE when decoding protocol (cherry picked from commit c72bf53cb178d2d9d310f3f369c0cbdb22e6f50c) Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/19998d31 Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/19998d31 Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/19998d31 Branch: refs/heads/2.6.x Commit: 19998d310f143ad5370683db42c63f64b43ee338 Parents: fd303af Author: Justin Bertram <[email protected]> Authored: Wed Sep 26 14:27:14 2018 -0500 Committer: Clebert Suconic <[email protected]> Committed: Thu Sep 27 10:25:12 2018 -0400 ---------------------------------------------------------------------- .../apache/activemq/artemis/core/protocol/ProtocolHandler.java | 4 ++++ .../activemq/artemis/core/server/ActiveMQServerLogger.java | 4 ++++ 2 files changed, 8 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/19998d31/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/ProtocolHandler.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/ProtocolHandler.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/ProtocolHandler.java index 0ba3ae7..e68e814 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/ProtocolHandler.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/ProtocolHandler.java @@ -196,6 +196,10 @@ public class ProtocolHandler { } ProtocolManager protocolManagerToUse = protocolMap.get(protocolToUse); + if (protocolManagerToUse == null) { + ActiveMQServerLogger.LOGGER.failedToFindProtocolManager(ctx.channel() == null ? null : ctx.channel().remoteAddress() == null ? null : ctx.channel().remoteAddress().toString(), ctx.channel() == null ? null : ctx.channel().localAddress() == null ? null : ctx.channel().localAddress().toString(), protocolToUse, protocolMap.keySet().toString()); + return; + } ConnectionCreator channelHandler = nettyAcceptor.createConnectionCreator(); ChannelPipeline pipeline = ctx.pipeline(); protocolManagerToUse.addChannelHandlers(pipeline); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/19998d31/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java index 6ebecd6..16dc972 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java @@ -1964,4 +1964,8 @@ public interface ActiveMQServerLogger extends BasicLogger { @LogMessage(level = Logger.Level.ERROR) @Message(id = 224095, value = "Error updating Consumer Count: {0}", format = Message.Format.MESSAGE_FORMAT) void consumerCountError(String reason); + + @LogMessage(level = Logger.Level.ERROR) + @Message(id = 224096, value = "Error setting up connection from {0} to {1}; protocol {2} not found in map: {3}", format = Message.Format.MESSAGE_FORMAT) + void failedToFindProtocolManager(String remoteAddress, String localAddress, String intendedProtocolManager, String protocolMap); }
