You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2021/04/30 03:42:35 UTC
[dubbo] branch master updated: Fix remoteMap may be null to avoid
NullPointerException being thrown (#7654)
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 <qh...@qq.com>
AuthorDate: Fri Apr 30 11:42:18 2021 +0800
Fix remoteMap may be null to avoid NullPointerException being thrown (#7654)
Signed-off-by: xingrufei <xi...@sogou-inc.com>
Co-authored-by: xingrufei <xi...@sogou-inc.com>
---
.../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);
+ }
}
}