Skip to content

Commit

Permalink
ARTEMIS-2098 potential NPE when decoding protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
jbertram authored and clebertsuconic committed Sep 27, 2018
1 parent 5a60011 commit c72bf53
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Expand Up @@ -196,6 +196,10 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) t
}

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);
Expand Down
Expand Up @@ -1964,4 +1964,8 @@ void slowConsumerDetected(String sessionID,
@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);
}

0 comments on commit c72bf53

Please sign in to comment.