You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by gu...@apache.org on 2021/10/27 08:19:45 UTC

[dubbo] branch 3.0 updated: [3.0-Triple] Fix wrapper overload method npe (#9142)

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

guohao pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.0 by this push:
     new 65882a0  [3.0-Triple] Fix wrapper overload method npe (#9142)
65882a0 is described below

commit 65882a0f914033c3d2481bb76597a2b691dd05de
Author: earthchen <yo...@duobei.com>
AuthorDate: Wed Oct 27 03:19:31 2021 -0500

    [3.0-Triple] Fix wrapper overload method npe (#9142)
    
    * fix 9139
    
    * fix not wrapper
    
    * opt
---
 .../dubbo/rpc/protocol/tri/UnaryServerStream.java   | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/UnaryServerStream.java b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/UnaryServerStream.java
index 0cc5efa..15be193 100644
--- a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/UnaryServerStream.java
+++ b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/UnaryServerStream.java
@@ -62,12 +62,23 @@ public class UnaryServerStream extends AbstractServerStream implements Stream {
         }
 
         public void invoke() {
-            RpcInvocation invocation = buildInvocation(getHeaders());
-            final Object[] arguments = deserializeRequest(getData());
-            if (arguments == null) {
-                return;
+            RpcInvocation invocation;
+            if (getMethodDescriptor().isNeedWrap()) {
+                // For wrapper overload methods, the methodDescriptor needs to get from data, so parse the request first
+                final Object[] arguments = deserializeRequest(getData());
+                if (arguments == null) {
+                    return;
+                }
+                invocation = buildInvocation(getHeaders());
+                invocation.setArguments(arguments);
+            } else {
+                invocation = buildInvocation(getHeaders());
+                final Object[] arguments = deserializeRequest(getData());
+                if (arguments == null) {
+                    return;
+                }
+                invocation.setArguments(arguments);
             }
-            invocation.setArguments(arguments);
             final Result result = getInvoker().invoke(invocation);
             CompletionStage<Object> future = result.thenApply(Function.identity());
             future.whenComplete((o, throwable) -> {