mytang0 commented on code in PR #11572:
URL: https://github.com/apache/dubbo/pull/11572#discussion_r1107949117


##########
dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/ReflectionPackableMethod.java:
##########
@@ -390,12 +393,27 @@ public byte[] pack(Object obj) throws IOException {
             }
             final TripleCustomerProtocolWapper.TripleRequestWrapper.Builder 
builder = 
TripleCustomerProtocolWapper.TripleRequestWrapper.Builder.newBuilder();
             builder.setSerializeType(serialize);
-            for (Object argument : arguments) {
-                builder.addArgTypes(argument.getClass().getName());
+
+            for (int i = 0 ; i < arguments.length; i++) {

Review Comment:
   You can consider doing a length check on arguments and types to avoid 
overflow.



##########
dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/ReflectionPackableMethod.java:
##########
@@ -370,14 +369,18 @@ private static class WrapRequestPack implements Pack {
         private final URL url;
         private final boolean singleArgument;
 
+        private Class<?>[] actualRequestTypes;

Review Comment:
   Please add the final modifier



##########
dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/ReflectionPackableMethod.java:
##########
@@ -390,12 +393,27 @@ public byte[] pack(Object obj) throws IOException {
             }
             final TripleCustomerProtocolWapper.TripleRequestWrapper.Builder 
builder = 
TripleCustomerProtocolWapper.TripleRequestWrapper.Builder.newBuilder();
             builder.setSerializeType(serialize);
-            for (Object argument : arguments) {
-                builder.addArgTypes(argument.getClass().getName());
+
+            for (int i = 0 ; i < arguments.length; i++) {
+                Object argument = arguments[i];
+                String paramTypeName;
+                Class<?> paramTypeClass;
+
+                if (argument == null) {
+                    paramTypeName = actualRequestTypes[i].getName();
+                    paramTypeClass = actualRequestTypes[i];
+                }else{
+                    paramTypeName = arguments[i].getClass().getName();
+                    paramTypeClass = arguments[i].getClass();
+                }
+

Review Comment:
   The parameter type has been passed in, so there is no need to use 
arguments[i].getClass()



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org
For additional commands, e-mail: notifications-h...@dubbo.apache.org

Reply via email to