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

liujun pushed a commit to branch 3.x-dev
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git


The following commit(s) were added to refs/heads/3.x-dev by this push:
     new 21e6491  修复 invocation 不能传递 attributes 的问题 (#4024)
21e6491 is described below

commit 21e64919c702eb1b2aefa557c25711af3f1612ef
Author: qinliujie <[email protected]>
AuthorDate: Fri May 10 18:18:07 2019 +0800

    修复 invocation 不能传递 attributes 的问题 (#4024)
---
 .../src/main/java/org/apache/dubbo/rpc/RpcInvocation.java            | 3 ++-
 .../src/main/java/org/apache/dubbo/rpc/filter/GenericFilter.java     | 5 +++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git 
a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/RpcInvocation.java 
b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/RpcInvocation.java
index 601564e..07e28b8 100644
--- 
a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/RpcInvocation.java
+++ 
b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/RpcInvocation.java
@@ -91,9 +91,10 @@ public class RpcInvocation implements Invocation, 
Serializable {
         this(method.getName(), method.getParameterTypes(), arguments, null, 
null);
     }
 
-    public RpcInvocation(Method method, Object[] arguments, Map<String, 
String> attachment) {
+    public RpcInvocation(Method method, Object[] arguments, Map<String, 
String> attachment, Map<Object, Object> attributes) {
         this(method.getName(), method.getParameterTypes(), arguments, 
attachment, null);
         this.returnType = method.getReturnType();
+        this.attributes = attributes == null ? new HashMap<>() : attributes;
     }
 
     public RpcInvocation(String methodName, Class<?>[] parameterTypes, 
Object[] arguments) {
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 190f8a1..fbd9c44 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
@@ -79,7 +79,7 @@ public class GenericFilter extends ListenableFilter {
                 } else if (ProtocolUtils.isJavaGenericSerialization(generic)) {
                     for (int i = 0; i < args.length; i++) {
                         if (byte[].class == args[i].getClass()) {
-                            try(UnsafeByteArrayInputStream is = new 
UnsafeByteArrayInputStream((byte[]) args[i])) {
+                            try (UnsafeByteArrayInputStream is = new 
UnsafeByteArrayInputStream((byte[]) args[i])) {
                                 args[i] = 
ExtensionLoader.getExtensionLoader(Serialization.class)
                                         
.getExtension(Constants.GENERIC_SERIALIZATION_NATIVE_JAVA)
                                         .deserialize(null, is).readObject();
@@ -111,7 +111,8 @@ public class GenericFilter extends ListenableFilter {
                         }
                     }
                 }
-                return invoker.invoke(new RpcInvocation(method, args, 
inv.getAttachments()));
+
+                return invoker.invoke(new RpcInvocation(method, args, 
inv.getAttachments(), inv.getAttributes()));
             } catch (NoSuchMethodException e) {
                 throw new RpcException(e.getMessage(), e);
             } catch (ClassNotFoundException e) {

Reply via email to