activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From michaelandrepearce <...@git.apache.org>
Subject [GitHub] activemq-artemis pull request #2334: ARTEMIS-2098 potential NPE when decodin...
Date Wed, 26 Sep 2018 19:42:27 GMT
Github user michaelandrepearce commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/2334#discussion_r220697913
  
    --- 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.
    
    ctx.channel().remoteAddress().toString()
    ctx.channel().localAddress().toString()
    
    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


---

Mime
View raw message