BurningCN commented on a change in pull request #9604:
URL: https://github.com/apache/dubbo/pull/9604#discussion_r789432520



##########
File path: 
dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/directory/AbstractDirectory.java
##########
@@ -148,26 +152,26 @@ public AbstractDirectory(URL url, RouterChain<T> 
routerChain, boolean isUrlFromR
         this.queryMap = 
applicationModel.getBeanFactory().getBean(ClusterUtils.class).mergeLocalParams(queryMap);
 
         if (consumerUrl == null) {
-            String host = StringUtils.isNotEmpty(queryMap.get("register.ip")) 
? queryMap.get("register.ip") : this.url.getHost();
-            String path = queryMap.get(PATH_KEY);
-            String consumedProtocol = queryMap.get(PROTOCOL_KEY) == null ? 
DUBBO : queryMap.get(PROTOCOL_KEY);
+            String host = 
StringUtils.isNotEmpty(queryMap.get(REGISTER_IP_KEY)) ? 
queryMap.get(REGISTER_IP_KEY) : this.url.getHost();
+            String path = StringUtils.isNotEmpty(queryMap.get(PATH_KEY)) ? 
queryMap.get(PATH_KEY) : queryMap.get(INTERFACE_KEY);
+            String consumedProtocol = 
StringUtils.isNotEmpty(queryMap.get(PROTOCOL_KEY)) ? queryMap.get(PROTOCOL_KEY) 
: DUBBO;
 
             URL consumerUrlFrom = this.url
                 .setHost(host)
                 .setPort(0)
                 .setProtocol(consumedProtocol)
-                .setPath(path == null ? queryMap.get(INTERFACE_KEY) : path);
+                .setPath(path);
             if (isUrlFromRegistry) {
                 // reserve parameters if url is already a consumer url
-                consumerUrlFrom = 
consumerUrlFrom.clearParameters().setServiceModel(url.getServiceModel()).setScopeModel(url.getScopeModel());
+                consumerUrlFrom = consumerUrlFrom.clearParameters();

Review comment:
       Because the `consumerUrlFrom` will directly have the `attributes` 
attribute of the `this.url`, there are already `scopeModel` and `serviceModel` 
in the `attributes`
   
![image](https://user-images.githubusercontent.com/43363120/150489049-6486f2d2-b735-403a-a2ea-8f1608d1fce3.png)
   




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to