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 2022/07/06 06:27:58 UTC

[dubbo] 01/07: fix UnsupportedOperationException in invokeSetParameters (#10262)

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

albumenj pushed a commit to branch 3.1
in repository https://gitbox.apache.org/repos/asf/dubbo.git

commit 3435872229f0d015bcd64049d2f8a26bc07fd6c3
Author: cheese8 <yi...@163.com>
AuthorDate: Mon Jul 4 09:37:06 2022 +0800

    fix UnsupportedOperationException in invokeSetParameters (#10262)
    
    * fix UnsupportedOperationException 10257
    
    * Update AbstractConfig.java
    
    * Update AbstractConfig.java
---
 .../src/main/java/org/apache/dubbo/config/AbstractConfig.java      | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractConfig.java b/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractConfig.java
index 5d4ee5f1b4..d37f3e919f 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractConfig.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractConfig.java
@@ -823,8 +823,11 @@ public abstract class AbstractConfig implements Serializable {
         if (CollectionUtils.isEmptyMap(values)) {
             return;
         }
-        Map<String, String> map = invokeGetParameters(obj.getClass(), obj);
-        map = map == null ? new HashMap<>() : map;
+        Map<String, String> map = new HashMap<>();
+        Map<String, String> getParametersMap = invokeGetParameters(obj.getClass(), obj);
+        if (getParametersMap != null && !getParametersMap.isEmpty()) {
+            map.putAll(getParametersMap);
+        }
         map.putAll(values);
         invokeSetParameters(obj.getClass(), obj, map);
     }