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 2018/09/27 14:24:49 UTC

[2/2] activemq-artemis git commit: ARTEMIS-2098 potential NPE when decoding protocol

ARTEMIS-2098 potential NPE when decoding protocol


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/c72bf53c
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/c72bf53c
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/c72bf53c

Branch: refs/heads/master
Commit: c72bf53cb178d2d9d310f3f369c0cbdb22e6f50c
Parents: 5a60011
Author: Justin Bertram <jb...@apache.org>
Authored: Wed Sep 26 14:27:14 2018 -0500
Committer: Clebert Suconic <cl...@apache.org>
Committed: Thu Sep 27 10:24:33 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/c72bf53c/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/c72bf53c/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 8c18a15..7785fe0 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);
 }