You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2022/05/26 08:41:30 UTC

[james-project] branch master updated: JAMES-3715 Prevent possible NPE upon inactive SMTP channel (#1014)

This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git


The following commit(s) were added to refs/heads/master by this push:
     new e8c026d6a2 JAMES-3715 Prevent possible NPE upon inactive SMTP channel (#1014)
e8c026d6a2 is described below

commit e8c026d6a210e3c1de429b87a7d5103e22c14ba6
Author: Benoit TELLIER <bt...@linagora.com>
AuthorDate: Thu May 26 15:41:26 2022 +0700

    JAMES-3715 Prevent possible NPE upon inactive SMTP channel (#1014)
---
 .../org/apache/james/protocols/netty/BasicChannelInboundHandler.java  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/protocols/netty/src/main/java/org/apache/james/protocols/netty/BasicChannelInboundHandler.java b/protocols/netty/src/main/java/org/apache/james/protocols/netty/BasicChannelInboundHandler.java
index 2333a79b81..a84e7b08a4 100644
--- a/protocols/netty/src/main/java/org/apache/james/protocols/netty/BasicChannelInboundHandler.java
+++ b/protocols/netty/src/main/java/org/apache/james/protocols/netty/BasicChannelInboundHandler.java
@@ -134,7 +134,7 @@ public class BasicChannelInboundHandler extends ChannelInboundHandlerAdapter imp
                     connectHandler.onDisconnect(session);
                 }
             }
-            LOGGER.info("Connection closed for {}", session.getRemoteAddress().getAddress().getHostAddress());
+            LOGGER.info("Connection closed for {}", ctx.channel().remoteAddress());
             cleanup(ctx);
             super.channelInactive(ctx);
         }
@@ -187,7 +187,7 @@ public class BasicChannelInboundHandler extends ChannelInboundHandlerAdapter imp
      * Cleanup the channel
      */
     protected void cleanup(ChannelHandlerContext ctx) {
-        ProtocolSession session = (ProtocolSession) ctx.channel().attr(SESSION_ATTRIBUTE_KEY).getAndRemove();
+        ProtocolSession session = (ProtocolSession) ctx.channel().attr(SESSION_ATTRIBUTE_KEY).getAndSet(null);
         if (session != null) {
             session.resetState();
         }


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org