<ul dir="auto">
<li>[*] I have searched the <a href="https://github.com/apache/dubbo/issues">issues</a> of this repository and believe that this is not a duplicate.</li>
<li>[*] I have checked the <a href="https://github.com/apache/dubbo/blob/master/FAQ.md">FAQ</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>Dubbo version: 2.7.7</li>
<li>Operating System version: MacOS</li>
<li>Java version: 1.8</li>
</ul>
<h3 dir="auto">Codes</h3>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="    public URL toUrl() {
        String address = this.getAddress();
        if (StringUtils.isEmpty(address)) {
            return null;
        }
        Map&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();
        appendParameters(map, this);
        if (!StringUtils.isEmpty(address)) {
            URL url = URL.valueOf(address);
            map.put(&quot;metadata&quot;, url.getProtocol());
            return new URL(&quot;metadata&quot;, url.getUsername(), url.getPassword(), url.getHost(),
                    url.getPort(), url.getPath(), map);
        }
        throw new IllegalArgumentException(&quot;The address of metadata report is invalid.&quot;);
    }"><pre class="notranslate">    <span class="pl-k">public</span> <span class="pl-smi">URL</span> <span class="pl-s1">toUrl</span>() {
        <span class="pl-smi">String</span> <span class="pl-s1">address</span> = <span class="pl-smi">this</span>.<span class="pl-en">getAddress</span>();
        <span class="pl-k">if</span> (<span class="pl-smi">StringUtils</span>.<span class="pl-en">isEmpty</span>(<span class="pl-s1">address</span>)) {
            <span class="pl-k">return</span> <span class="pl-c1">null</span>;
        }
        <span class="pl-smi">Map</span>&lt;<span class="pl-smi">String</span>, <span class="pl-smi">String</span>&gt; <span class="pl-s1">map</span> = <span class="pl-k">new</span> <span class="pl-smi">HashMap</span>&lt;<span class="pl-smi">String</span>, <span class="pl-smi">String</span>&gt;();
        <span class="pl-en">appendParameters</span>(<span class="pl-s1">map</span>, <span class="pl-smi">this</span>);
        <span class="pl-k">if</span> (!<span class="pl-smi">StringUtils</span>.<span class="pl-en">isEmpty</span>(<span class="pl-s1">address</span>)) {
            <span class="pl-smi">URL</span> <span class="pl-s1">url</span> = <span class="pl-smi">URL</span>.<span class="pl-en">valueOf</span>(<span class="pl-s1">address</span>);
            <span class="pl-s1">map</span>.<span class="pl-en">put</span>(<span class="pl-s">"metadata"</span>, <span class="pl-s1">url</span>.<span class="pl-en">getProtocol</span>());
            <span class="pl-k">return</span> <span class="pl-k">new</span> <span class="pl-smi">URL</span>(<span class="pl-s">"metadata"</span>, <span class="pl-s1">url</span>.<span class="pl-en">getUsername</span>(), <span class="pl-s1">url</span>.<span class="pl-en">getPassword</span>(), <span class="pl-s1">url</span>.<span class="pl-en">getHost</span>(),
                    <span class="pl-s1">url</span>.<span class="pl-en">getPort</span>(), <span class="pl-s1">url</span>.<span class="pl-en">getPath</span>(), <span class="pl-s1">map</span>);
        }
        <span class="pl-k">throw</span> <span class="pl-k">new</span> <span class="pl-smi">IllegalArgumentException</span>(<span class="pl-s">"The address of metadata report is invalid."</span>);
    }</pre></div>
<p dir="auto">原因：创建元数据中心地址没有保留源address上的namespace参数</p>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have searched the <a href="https://github.com/apache/incubator-dubbo/issues">issues</a> of this repository and believe that this is not a duplicate.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have checked the <a href="https://github.com/apache/incubator-dubbo/blob/master/FAQ.md">FAQ</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>Dubbo version: 3.5.2</li>
<li>Operating System version: linux</li>
<li>Java version:java 8</li>
</ul>
<h3 dir="auto">Steps to reproduce this issue</h3>
<ol dir="auto">
<li>dubbo管理后台，先选中一个服务提供者，选择半权</li>
<li>在权重调节的标签下可以看到上一步设置的半权</li>
<li>点击编辑，设定权重值，保存后，只剩下提供者的ip，端口号丢失</li>
</ol>
<h3 dir="auto">Expected Result</h3>
<p dir="auto">正常调节权重</p>
<h3 dir="auto">Actual Result</h3>
<p dir="auto">What actually happens?</p>
<p dir="auto">If there is an exception, please attach the exception trace:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Just put your stack trace here!"><pre class="notranslate"><code class="notranslate">Just put your stack trace here!
</code></pre></div>