[3.0] fix #10045, fix unsupported operation list (#10049)

* fix #10045, use ArrayList

* fix checkstyle

* fix #10045, fix unsupported operation lis

Co-authored-by: 呈铭 <beck.wcm@antgroup.com>
This commit is contained in:
Wang Chengming 2022-05-19 13:15:11 +08:00 committed by GitHub
parent 7ff818f36a
commit 7b8019fef6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -417,10 +417,13 @@ public class ServiceInstancesChangedListener {
}
protected List<URL> toUrlsWithEmpty(List<URL> urls) {
if (urls == null) {
boolean emptyProtectionEnabled = serviceDiscovery.getUrl().getParameter(ENABLE_EMPTY_PROTECTION_KEY, true);
if (!emptyProtectionEnabled && urls == null) {
urls = new ArrayList<>();
} else if (emptyProtectionEnabled && urls == null) {
urls = Collections.emptyList();
}
boolean emptyProtectionEnabled = serviceDiscovery.getUrl().getParameter(ENABLE_EMPTY_PROTECTION_KEY, true);
if (CollectionUtils.isEmpty(urls) && !emptyProtectionEnabled) {
// notice that the service of this.url may not be the same as notify listener.
URL empty = URLBuilder.from(this.url)