You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2022/08/01 03:26:09 UTC

[GitHub] [dubbo] BurningCN commented on a diff in pull request #10389: Optimize the logic of ConfigConfigurationAdapter to get prefixed meta…

BurningCN commented on code in PR #10389:
URL: https://github.com/apache/dubbo/pull/10389#discussion_r933811107


##########
dubbo-common/src/main/java/org/apache/dubbo/config/AbstractConfig.java:
##########
@@ -738,6 +754,19 @@ private void assignProperties(Object obj, Environment environment, Map<String, S
             } else if (isParametersSetter(method)) {
                 String propertyName = extractPropertyName(method.getName());
 
+                String value = StringUtils.trim(configuration.getString(propertyName));
+                Map<String, String> parameterMap;
+                if (StringUtils.hasText(value)) {
+                    parameterMap = StringUtils.parseParameters(value);
+                } else {
+                    // in this case, maybe parameters.item3=value3.
+                    parameterMap = ConfigurationUtils.getSubProperties(properties, PARAMETERS);
+                }
+                Map<String, String> newMap = convert(parameterMap, "");
+                if (CollectionUtils.isEmptyMap(newMap)) {
+                    continue;
+                }
+

Review Comment:
   这里是将下面红色删除的代码(即获取`newMap`的逻辑)挪到 获取`oldMap`逻辑 的上面,同时加了766~768行代码,这样当`newMap`为空的时候直接`continue`,不需要在处理后续逻辑。



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org