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/03/22 02:01:53 UTC

[james-project] 22/29: JAMES-3715 Fix IDLE when COMPRESS is enabled

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

commit 999d2c4d07532823d444c8d1f95aeb3ea820c6e7
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Thu Mar 17 16:01:48 2022 +0700

    JAMES-3715 Fix IDLE when COMPRESS is enabled
    
    Copy-less array did not account for offsets resulting in undesirable behaviour.
    
    Note that this is triggered only for line handlers and thus is irrelevant
    performance wise.
---
 .../apache/james/imapserver/netty/ImapLineHandlerAdapter.java    | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/ImapLineHandlerAdapter.java b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/ImapLineHandlerAdapter.java
index 2f1f260..c03e8d7 100644
--- a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/ImapLineHandlerAdapter.java
+++ b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/ImapLineHandlerAdapter.java
@@ -46,13 +46,8 @@ public class ImapLineHandlerAdapter extends ChannelInboundHandlerAdapter {
     @Override
     public void channelRead(ChannelHandlerContext ctx, Object msg) {
         ByteBuf buf = (ByteBuf) msg;
-        byte[] data;
-        if (buf.hasArray()) {
-            data = buf.array();
-        } else {
-            data = new byte[buf.readableBytes()];
-            buf.readBytes(data);
-        }
+        byte[] data = new byte[buf.readableBytes()];
+        buf.readBytes(data);
         lineHandler.onLine(session, data);
     }
 

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