You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by li...@apache.org on 2020/03/13 06:21:05 UTC

[dubbo] branch master updated: fix a potential NPE in CallbackServiceCodec.java. (#5768)

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

liujun 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 f8b8b3d  fix a potential NPE in CallbackServiceCodec.java. (#5768)
f8b8b3d is described below

commit f8b8b3d2ee6d97f9771411a0fdab3f5701c1fc32
Author: feijermu <se...@qq.com>
AuthorDate: Fri Mar 13 14:20:49 2020 +0800

    fix a potential NPE in CallbackServiceCodec.java. (#5768)
---
 .../org/apache/dubbo/rpc/protocol/dubbo/CallbackServiceCodec.java | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/CallbackServiceCodec.java b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/CallbackServiceCodec.java
index e30b34d..6c916d4 100644
--- a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/CallbackServiceCodec.java
+++ b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/CallbackServiceCodec.java
@@ -104,7 +104,13 @@ class CallbackServiceCodec {
         // add method, for verifying against method, automatic fallback (see dubbo protocol)
         params.put(METHODS_KEY, StringUtils.join(Wrapper.getWrapper(clazz).getDeclaredMethodNames(), ","));
 
-        Map<String, String> tmpMap = new HashMap<>(url.getParameters());
+        Map<String, String> tmpMap = new HashMap<>();
+        if (url != null) {
+            Map<String, String> parameters = url.getParameters();
+            if (parameters != null && !parameters.isEmpty()) {
+                tmpMap.putAll(parameters);
+            }
+        }
         tmpMap.putAll(params);
         tmpMap.remove(VERSION_KEY);// doesn't need to distinguish version for callback
         tmpMap.put(INTERFACE_KEY, clazz.getName());