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

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


The following commit(s) were added to refs/heads/3.2 by this push:
     new da5c7ed33d Fix generic array being changed (#13103)
da5c7ed33d is described below

commit da5c7ed33dd2ca53946b228f105453ccb0d80b93
Author: Albumen Kevin <[email protected]>
AuthorDate: Mon Sep 25 09:40:18 2023 +0800

    Fix generic array being changed (#13103)
---
 .../org/apache/dubbo/rpc/protocol/dubbo/DecodeableRpcInvocation.java | 5 +++--
 .../main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboCodec.java    | 2 --
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git 
a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DecodeableRpcInvocation.java
 
b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DecodeableRpcInvocation.java
index e677462e01..49cdac2313 100644
--- 
a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DecodeableRpcInvocation.java
+++ 
b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DecodeableRpcInvocation.java
@@ -158,9 +158,10 @@ public class DecodeableRpcInvocation extends RpcInvocation 
implements Codec, Dec
                 pts = drawPts(path, version, desc, pts);
                 if (pts == DubboCodec.EMPTY_CLASS_ARRAY) {
                     if (RpcUtils.isGenericCall(desc, getMethodName())) {
-                        pts = DubboCodec.GENERIC_PTS_ARRAY;
+                        // Should recreate here for each invocation because 
the parameterTypes may be changed by user.
+                        pts = new Class<?>[]{String.class, String[].class, 
Object[].class};
                     } else if (RpcUtils.isEcho(desc, getMethodName())) {
-                        pts = DubboCodec.ECHO_PTS_ARRAY;
+                        pts = new Class<?>[]{Object.class};
                     } else {
                         throw new IllegalArgumentException("Service not 
found:" + path + ", " + getMethodName());
                     }
diff --git 
a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboCodec.java
 
b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboCodec.java
index 169722e112..c775ae50a0 100644
--- 
a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboCodec.java
+++ 
b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboCodec.java
@@ -69,8 +69,6 @@ public class DubboCodec extends ExchangeCodec {
     public static final byte RESPONSE_NULL_VALUE_WITH_ATTACHMENTS = 5;
     public static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
     public static final Class<?>[] EMPTY_CLASS_ARRAY = new Class<?>[0];
-    public static final Class<?>[] GENERIC_PTS_ARRAY = new 
Class<?>[]{String.class, String[].class, Object[].class};
-    public static final Class<?>[] ECHO_PTS_ARRAY = new 
Class<?>[]{Object.class};
     private static final ErrorTypeAwareLogger log = 
LoggerFactory.getErrorTypeAwareLogger(DubboCodec.class);
 
     private static final AtomicBoolean decodeInUserThreadLogged = new 
AtomicBoolean(false);

Reply via email to