compatible with "default." key when parsing provider URL registed from zookeeper
- [x] I have searched the issues of this repository and believe that this is not a duplicate.
- [x] I have checked the FAQ of this repository and believe that this is not a duplicate.
Environment
- Dubbo version: 2.7.8
- Operating System version: macOS Catalina
- Java version: 1.8
Steps to reproduce this issue
when I regist a Provider Service with version in the form of "default.version" in zookeeper.
And Consumer use dubbo 2.7.8 will fail to find the Provider and will throw Exception as follow
Expected Result
Consumer can find Provider Service
Actual Result
Consumer can't find Provider Service and throw Exception as follow
No provider available from registry zk01.zeus.likemoon.com:2180 for service com.likemoon.api.rpc.XxxxFacade:1.0.0 on consumer 10.20.11.22 use dubbo version 2.7.8, please check status of providers(disabled, not registered or in blacklist)
as I debug the problem happened in ZookeeperRegistry.toUrlsWithoutEmpty method when using dubbo version >= 2.7.7
private List<URL> toUrlsWithoutEmpty(URL consumer, List<String> providers) {
List<URL> urls = new ArrayList<>();
if (CollectionUtils.isNotEmpty(providers)) {
for (String provider : providers) {
if (provider.contains(PROTOCOL_SEPARATOR_ENCODED)) {
// parseEncodedStr() method can't parse paramter wieh "default." prefix
URL url = URLStrParser.parseEncodedStr(provider);
if (UrlUtils.isMatch(consumer, url)) {
urls.add(url);
}
}
}
}
return urls;
}
URLStrParser.parseEncodedStr method is not compatible with "default." prefix
ps: I found URL.valueOf method has fixed the similar problem
dubbo v2.7.7 there is the same problem https://github.com/thubbo/jmeter-plugins-for-apache-dubbo/issues/125
#Environment Provider Dubbo version: 2.5.x、2.6.x Consumer Dubbo version:2.7.7、2.7.8 Registry Center:Zookeeper Config Center:none Java version: 1.8
There is a problem of backward compatibility, please pay attention! @chickenlj @hengyunabc @zonghaishang @beiwei30 @kimmking
could anyone pay attention to this problem ? @chickenlj @beiwei30
@likemoongg hi,I think this issue has been fix by #7239.
Please feel free to reopen it if you haven any question.