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

victory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git


The following commit(s) were added to refs/heads/master by this push:
     new 72fe93b  fix issue #3713: 
org.apache.dubbo.rpc.support.MockInvoker#getInterface should not return null 
(#3716)
72fe93b is described below

commit 72fe93bf22c1f7db88b5d083c9570b27e1032542
Author: Ian Luo <[email protected]>
AuthorDate: Mon Apr 29 17:41:53 2019 +0800

    fix issue #3713: org.apache.dubbo.rpc.support.MockInvoker#getInterface 
should not return null (#3716)
---
 .../dubbo/rpc/cluster/support/wrapper/MockClusterInvoker.java      | 4 ++--
 .../src/main/java/org/apache/dubbo/rpc/support/MockInvoker.java    | 7 ++++---
 .../src/main/java/org/apache/dubbo/rpc/support/MockProtocol.java   | 2 +-
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockClusterInvoker.java
 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockClusterInvoker.java
index 009f4df..5930314 100644
--- 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockClusterInvoker.java
+++ 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockClusterInvoker.java
@@ -88,7 +88,7 @@ public class MockClusterInvoker<T> implements Invoker<T> {
                 if (e.isBiz()) {
                     throw e;
                 }
-                
+
                 if (logger.isWarnEnabled()) {
                     logger.warn("fail-mock: " + invocation.getMethodName() + " 
fail-mock enabled , url : " + directory.getUrl(), e);
                 }
@@ -105,7 +105,7 @@ public class MockClusterInvoker<T> implements Invoker<T> {
 
         List<Invoker<T>> mockInvokers = selectMockInvoker(invocation);
         if (CollectionUtils.isEmpty(mockInvokers)) {
-            minvoker = (Invoker<T>) new MockInvoker(directory.getUrl());
+            minvoker = (Invoker<T>) new MockInvoker(directory.getUrl(), 
directory.getInterface());
         } else {
             minvoker = mockInvokers.get(0);
         }
diff --git 
a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/support/MockInvoker.java
 
b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/support/MockInvoker.java
index 436fb47..923c7cb 100644
--- 
a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/support/MockInvoker.java
+++ 
b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/support/MockInvoker.java
@@ -46,9 +46,11 @@ final public class MockInvoker<T> implements Invoker<T> {
     private final static Map<String, Throwable> throwables = new 
ConcurrentHashMap<String, Throwable>();
 
     private final URL url;
+    private final Class<T> type;
 
-    public MockInvoker(URL url) {
+    public MockInvoker(URL url, Class<T> type) {
         this.url = url;
+        this.type = type;
     }
 
     public static Object parseMockValue(String mock) throws Exception {
@@ -251,7 +253,6 @@ final public class MockInvoker<T> implements Invoker<T> {
 
     @Override
     public Class<T> getInterface() {
-        //FIXME
-        return null;
+        return type;
     }
 }
diff --git 
a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/support/MockProtocol.java
 
b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/support/MockProtocol.java
index 0b6f4d1..9237ab9 100644
--- 
a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/support/MockProtocol.java
+++ 
b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/support/MockProtocol.java
@@ -39,6 +39,6 @@ final public class MockProtocol extends AbstractProtocol {
 
     @Override
     public <T> Invoker<T> refer(Class<T> type, URL url) throws RpcException {
-        return new MockInvoker<T>(url);
+        return new MockInvoker<>(url, type);
     }
 }

Reply via email to