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
@@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Locale;
import com.netflix.appinfo.InstanceInfo; import com.netflix.appinfo.InstanceInfo;
import com.netflix.discovery.EurekaClient; import com.netflix.discovery.EurekaClient;
@@ -35,6 +36,7 @@ import org.springframework.core.Ordered;
* *
* @author Spencer Gibb * @author Spencer Gibb
* @author Tim Ysewyn * @author Tim Ysewyn
* @author Olga Maciaszek-Sharma
*/ */
public class EurekaDiscoveryClient implements DiscoveryClient { public class EurekaDiscoveryClient implements DiscoveryClient {
@@ -79,7 +81,7 @@ public class EurekaDiscoveryClient implements DiscoveryClient {
if (app.getInstances().isEmpty()) { if (app.getInstances().isEmpty()) {
continue; continue;
} }
names.add(app.getName().toLowerCase()); names.add(app.getName().toLowerCase(Locale.ROOT));
} }
return names; return names;
@@ -19,6 +19,7 @@ package org.springframework.cloud.netflix.eureka.server;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.Set; import java.util.Set;
@@ -234,7 +235,8 @@ public class EurekaServerConfigBean implements EurekaServerConfig {
@Override @Override
public Set<String> getRemoteRegionAppWhitelist(String regionName) { 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 @Override
@@ -14,4 +14,8 @@
<suppress files=".*TestAutoConfiguration\.java" checks="JavadocStyle"/> <suppress files=".*TestAutoConfiguration\.java" checks="JavadocStyle"/>
<suppress files=".*Tests\.java" checks="JavadocVariable"/> <suppress files=".*Tests\.java" checks="JavadocVariable"/>
<suppress files=".*EurekaConfigServerBootstrapperIT\.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> </suppressions>