This is an automated email from the ASF dual-hosted git repository.
earthchen pushed a commit to branch 3.1
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.1 by this push:
new 9e38c48b68 fix tri wrapper pack npe (#11656)
9e38c48b68 is described below
commit 9e38c48b685b6e47862f697add746b018c745ab0
Author: earthchen <[email protected]>
AuthorDate: Sat Feb 25 20:12:34 2023 +0800
fix tri wrapper pack npe (#11656)
---
.../apache/dubbo/rpc/protocol/tri/ReflectionPackableMethod.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git
a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/ReflectionPackableMethod.java
b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/ReflectionPackableMethod.java
index 39e16fa7cd..8667beb87a 100644
---
a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/ReflectionPackableMethod.java
+++
b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/ReflectionPackableMethod.java
@@ -360,6 +360,7 @@ public class ReflectionPackableMethod implements
PackableMethod {
private final String serialize;
private final MultipleSerialization multipleSerialization;
private final String[] argumentsType;
+ private final Class<?>[] actualRequestTypes;
private final URL url;
private final boolean singleArgument;
@@ -371,6 +372,7 @@ public class ReflectionPackableMethod implements
PackableMethod {
this.url = url;
this.serialize = convertHessianToWrapper(serialize);
this.multipleSerialization = multipleSerialization;
+ this.actualRequestTypes = actualRequestTypes;
this.argumentsType =
Stream.of(actualRequestTypes).map(Class::getName).toArray(String[]::new);
this.singleArgument = singleArgument;
}
@@ -388,9 +390,10 @@ public class ReflectionPackableMethod implements
PackableMethod {
for (String type : argumentsType) {
builder.addArgTypes(type);
}
- for (Object argument : arguments) {
+ for (int i = 0; i < arguments.length; i++) {
+ Object argument = arguments[i];
ByteArrayOutputStream bos = new ByteArrayOutputStream();
- multipleSerialization.serialize(url, serialize,
argument.getClass(), argument, bos);
+ multipleSerialization.serialize(url, serialize,
actualRequestTypes[i], argument, bos);
builder.addArgs(bos.toByteArray());
}
return builder.build().toByteArray();