This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/master by this push:
new 8d5417d Convert the IllegalArgumentException generated by
PojoUtils.realize in GenericFilter to RpcException (#7643)
8d5417d is described below
commit 8d5417d90dc48cbc49d632d11ddadad76e36537f
Author: xiaoheng1 <[email protected]>
AuthorDate: Thu Apr 29 19:24:51 2021 +0800
Convert the IllegalArgumentException generated by PojoUtils.realize in
GenericFilter to RpcException (#7643)
---
.../java/org/apache/dubbo/rpc/filter/GenericFilter.java | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git
a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/GenericFilter.java
b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/GenericFilter.java
index 2e6d3a8..0610d2b 100644
---
a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/GenericFilter.java
+++
b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/GenericFilter.java
@@ -93,7 +93,11 @@ public class GenericFilter implements Filter,
Filter.Listener {
if (StringUtils.isEmpty(generic)
|| ProtocolUtils.isDefaultGenericSerialization(generic)
|| ProtocolUtils.isGenericReturnRawResult(generic)) {
- args = PojoUtils.realize(args, params,
method.getGenericParameterTypes());
+ try {
+ args = PojoUtils.realize(args, params,
method.getGenericParameterTypes());
+ } catch (IllegalArgumentException e) {
+ throw new RpcException(e);
+ }
} else if (ProtocolUtils.isJavaGenericSerialization(generic)) {
Configuration configuration =
ApplicationModel.getEnvironment().getConfiguration();
if
(!configuration.getBoolean(CommonConstants.ENABLE_NATIVE_JAVA_GENERIC_SERIALIZE,
false)) {
@@ -162,7 +166,9 @@ public class GenericFilter implements Filter,
Filter.Listener {
}
}
- RpcInvocation rpcInvocation = new RpcInvocation(method,
invoker.getInterface().getName(), invoker.getUrl().getProtocolServiceKey(),
args, inv.getObjectAttachments(), inv.getAttributes());
+ RpcInvocation rpcInvocation =
+ new RpcInvocation(method,
invoker.getInterface().getName(), invoker.getUrl().getProtocolServiceKey(),
args,
+ inv.getObjectAttachments(),
inv.getAttributes());
rpcInvocation.setInvoker(inv.getInvoker());
rpcInvocation.setTargetServiceUniqueName(inv.getTargetServiceUniqueName());
@@ -200,7 +206,8 @@ public class GenericFilter implements Filter,
Filter.Listener {
if (ProtocolUtils.isJavaGenericSerialization(generic)) {
try {
UnsafeByteArrayOutputStream os = new
UnsafeByteArrayOutputStream(512);
-
ExtensionLoader.getExtensionLoader(Serialization.class).getExtension(GENERIC_SERIALIZATION_NATIVE_JAVA).serialize(null,
os).writeObject(appResponse.getValue());
+
ExtensionLoader.getExtensionLoader(Serialization.class).getExtension(GENERIC_SERIALIZATION_NATIVE_JAVA)
+ .serialize(null,
os).writeObject(appResponse.getValue());
appResponse.setValue(os.toByteArray());
} catch (IOException e) {
throw new RpcException(