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 ed1d357  Fix remoteMap may be null to avoid NullPointerException being 
thrown (#7654)
ed1d357 is described below

commit ed1d357a6a0bcc12fa4cd6421ac469b632421765
Author: skyguard1 <[email protected]>
AuthorDate: Fri Apr 30 11:42:18 2021 +0800

    Fix remoteMap may be null to avoid NullPointerException being thrown (#7654)
    
    Signed-off-by: xingrufei <[email protected]>
    
    Co-authored-by: xingrufei <[email protected]>
---
 .../dubbo/rpc/cluster/support/ClusterUtils.java    | 30 ++++++++++++----------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/ClusterUtils.java
 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/ClusterUtils.java
index d279674..f097f92 100644
--- 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/ClusterUtils.java
+++ 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/ClusterUtils.java
@@ -103,20 +103,22 @@ public class ClusterUtils {
 
             map.putAll(copyOfLocalMap);
 
-            map.put(REMOTE_APPLICATION_KEY, remoteMap.get(APPLICATION_KEY));
-
-            // Combine filters and listeners on Provider and Consumer
-            String remoteFilter = remoteMap.get(REFERENCE_FILTER_KEY);
-            String localFilter = copyOfLocalMap.get(REFERENCE_FILTER_KEY);
-            if (remoteFilter != null && remoteFilter.length() > 0
-                    && localFilter != null && localFilter.length() > 0) {
-                map.put(REFERENCE_FILTER_KEY, remoteFilter + "," + 
localFilter);
-            }
-            String remoteListener = remoteMap.get(INVOKER_LISTENER_KEY);
-            String localListener = copyOfLocalMap.get(INVOKER_LISTENER_KEY);
-            if (remoteListener != null && remoteListener.length() > 0
-                    && localListener != null && localListener.length() > 0) {
-                map.put(INVOKER_LISTENER_KEY, remoteListener + "," + 
localListener);
+            if (remoteMap != null) {
+                map.put(REMOTE_APPLICATION_KEY, 
remoteMap.get(APPLICATION_KEY));
+
+                // Combine filters and listeners on Provider and Consumer
+                String remoteFilter = remoteMap.get(REFERENCE_FILTER_KEY);
+                String localFilter = copyOfLocalMap.get(REFERENCE_FILTER_KEY);
+                if (remoteFilter != null && remoteFilter.length() > 0
+                        && localFilter != null && localFilter.length() > 0) {
+                    map.put(REFERENCE_FILTER_KEY, remoteFilter + "," + 
localFilter);
+                }
+                String remoteListener = remoteMap.get(INVOKER_LISTENER_KEY);
+                String localListener = 
copyOfLocalMap.get(INVOKER_LISTENER_KEY);
+                if (remoteListener != null && remoteListener.length() > 0
+                        && localListener != null && localListener.length() > 
0) {
+                    map.put(INVOKER_LISTENER_KEY, remoteListener + "," + 
localListener);
+                }
             }
         }
 

Reply via email to