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 2022/06/14 06:12:35 UTC

[dubbo] branch master updated: fix #9910, metadata-report support a separate configuration username and password (#9921)

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 8d9e252ff1 fix #9910, metadata-report support a separate configuration username and password (#9921)
8d9e252ff1 is described below

commit 8d9e252ff16093b367ef2abe981a7643dc1b61a1
Author: zhaoguhong <zh...@163.com>
AuthorDate: Tue Jun 14 14:12:29 2022 +0800

    fix #9910, metadata-report support a separate configuration username and password (#9921)
---
 .../java/org/apache/dubbo/config/MetadataReportConfig.java     | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/dubbo-common/src/main/java/org/apache/dubbo/config/MetadataReportConfig.java b/dubbo-common/src/main/java/org/apache/dubbo/config/MetadataReportConfig.java
index 24b622bdc6..0ce688c6d4 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/config/MetadataReportConfig.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/config/MetadataReportConfig.java
@@ -123,9 +123,13 @@ public class MetadataReportConfig extends AbstractConfig {
         map.putAll(convert(map, null));
         // put the protocol of URL as the "metadata"
         map.put("metadata", url.getProtocol());
-        return new URL("metadata", url.getUsername(), url.getPassword(), url.getHost(),
-                url.getPort(), url.getPath(), map);
-
+        return new URL("metadata",
+            StringUtils.isBlank(url.getUsername()) ? this.getUsername() : url.getUsername(),
+            StringUtils.isBlank(url.getPassword()) ? this.getPassword() : url.getPassword(),
+            url.getHost(),
+            // address port is priority
+            this.getPort() == null ? url.getPort() : url.getPort(this.getPort()),
+            url.getPath(), map);
     }
 
     public String getProtocol() {