Closed
Description
- I have searched the issues of this repository and believe that this is not a duplicate.
- I have checked the FAQ of this repository and believe that this is not a duplicate.
Environment
- Dubbo version: xxx
- Operating System version: xxx
- Java version: xxx
Steps to reproduce this issue
nacos registry serviceName may conflict when we have two provider with same service but one config version as A and left group empty and
one config group as A and left version empty
the two provider would get registered with same key provdier:serviceName:A.
the cause of this issue is we ignore empty value when we construct the key, relative code is
private String getServiceName(URL url) {
String category = url.getParameter(CATEGORY_KEY, DEFAULT_CATEGORY);
return getServiceName(url, category);
}
private String getServiceName(URL url, String category) {
StringBuilder serviceNameBuilder = new StringBuilder(category);
append(serviceNameBuilder, url, INTERFACE_KEY);
append(serviceNameBuilder, url, VERSION_KEY);
append(serviceNameBuilder, url, GROUP_KEY);
return serviceNameBuilder.toString();
}
private void append(StringBuilder target, URL url, String parameterName) {
target.append(SERVICE_NAME_SEPARATOR);
String parameterValue = url.getParameter(parameterName);
if (!StringUtils.isBlank(parameterValue)) {
target.append(parameterValue);
}
}
i think we should just keep a SEPARATOR as placeholder for empty value.
- xxx
- xxx
- xxx
Pls. provide [GitHub address] to reproduce this issue.
Expected Result
What do you expected from the above steps?
Actual Result
What actually happens?
If there is an exception, please attach the exception trace:
Just put your stack trace here!
Metadata
Metadata
Assignees
Labels
No labels