Adjust to blocking lower/uper-casing without locale.

This commit is contained in:
Olga Maciaszek-Sharma
2024-10-17 15:47:26 +02:00
parent da9cb76fcc
commit b1a0375ce4
3 changed files with 11 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2022 the original author or authors.
* Copyright 2013-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@ package org.springframework.cloud.netflix.eureka;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import com.netflix.appinfo.InstanceInfo;
import com.netflix.discovery.EurekaClient;
@@ -35,6 +36,7 @@ import org.springframework.core.Ordered;
*
* @author Spencer Gibb
* @author Tim Ysewyn
* @author Olga Maciaszek-Sharma
*/
public class EurekaDiscoveryClient implements DiscoveryClient {
@@ -79,7 +81,7 @@ public class EurekaDiscoveryClient implements DiscoveryClient {
if (app.getInstances().isEmpty()) {
continue;
}
names.add(app.getName().toLowerCase());
names.add(app.getName().toLowerCase(Locale.ROOT));
}
return names;

View File

@@ -19,6 +19,7 @@ package org.springframework.cloud.netflix.eureka.server;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
@@ -234,7 +235,8 @@ public class EurekaServerConfigBean implements EurekaServerConfig {
@Override
public Set<String> getRemoteRegionAppWhitelist(String regionName) {
return this.remoteRegionAppWhitelist.get(regionName == null ? "global" : regionName.trim().toLowerCase());
return this.remoteRegionAppWhitelist
.get(regionName == null ? "global" : regionName.trim().toLowerCase(Locale.ROOT));
}
@Override

View File

@@ -14,4 +14,8 @@
<suppress files=".*TestAutoConfiguration\.java" checks="JavadocStyle"/>
<suppress files=".*Tests\.java" checks="JavadocVariable"/>
<suppress files=".*EurekaConfigServerBootstrapperIT\.java" checks="JavadocVariable"/>
<suppress files="[\\/]src[\\/](test|testFixtures)[\\/](java|java21)[\\/]"
checks="RegexpSinglelineJava" id="toLowerCaseWithoutLocale"/>
<suppress files="[\\/]src[\\/](test|testFixtures)[\\/](java|java21)[\\/]"
checks="RegexpSinglelineJava" id="toUpperCaseWithoutLocale"/>
</suppressions>