diff --git a/pom.xml b/pom.xml index 458687c9..d3405932 100644 --- a/pom.xml +++ b/pom.xml @@ -22,7 +22,7 @@ 4.0.0 com.alipay.sofa bolt - 1.6.10 + 1.6.11-SNAPSHOT jar ${project.groupId}:${project.artifactId} diff --git a/src/main/java/com/alipay/remoting/rpc/protocol/RpcCommandDecoder.java b/src/main/java/com/alipay/remoting/rpc/protocol/RpcCommandDecoder.java index 3fd9bd4d..da053383 100644 --- a/src/main/java/com/alipay/remoting/rpc/protocol/RpcCommandDecoder.java +++ b/src/main/java/com/alipay/remoting/rpc/protocol/RpcCommandDecoder.java @@ -161,7 +161,9 @@ public void decode(ChannelHandlerContext ctx, ByteBuf in, List out) thro header = new byte[headerLen]; in.readBytes(header); } - if (contentLen > 0) { + if (contentLen == 0) { + content = new byte[0]; + } else if (contentLen > 0) { content = new byte[contentLen]; in.readBytes(content); } diff --git a/src/main/java/com/alipay/remoting/rpc/protocol/RpcCommandDecoderV2.java b/src/main/java/com/alipay/remoting/rpc/protocol/RpcCommandDecoderV2.java index 3c6bd921..9544a92a 100644 --- a/src/main/java/com/alipay/remoting/rpc/protocol/RpcCommandDecoderV2.java +++ b/src/main/java/com/alipay/remoting/rpc/protocol/RpcCommandDecoderV2.java @@ -201,6 +201,9 @@ public void decode(ChannelHandlerContext ctx, ByteBuf in, List out) thro header = new byte[headerLen]; in.readBytes(header); } + if (contentLen == 0) { + content = new byte[0]; + } if (contentLen > 0) { content = new byte[contentLen]; in.readBytes(content);