[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GitHub] activemq-artemis pull request #2334: ARTEMIS-2098 potential NPE when decodin...

Github user michaelandrepearce commented on a diff in the pull request:

    --- Diff: artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/ProtocolHandler.java ---
    @@ -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().remoteAddress().toString(), ctx.channel().localAddress().toString(), protocolToUse, protocolMap.keySet().toString());
    --- End diff --
    Question, how sure/guarenteed is it that these objects will def be wont be null them selves, aka doing this logger wont cause an NPE.
    is it worth null checking the dot train?
    e.g. is it worth doing?
    ctx.channel() == null ? null : ctx.channel().localAddress() == null ? null : ctx.channel().localAddress().toString