mirror of
https://github.com/google/nomulus.git
synced 2025-05-30 01:10:14 +02:00
Replace uses of X.to(Upper|Lower)Case() with Ascii.to(Upper|Lower)Case(X)
Locales are weird. Even if all our character individually are just 0-9a-z_, different locales might still convert them differently to upper/lower cases... ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=193512312
This commit is contained in:
parent
f289259101
commit
7bf8c02264
3 changed files with 7 additions and 3 deletions
|
@ -17,6 +17,7 @@ package google.registry.proxy;
|
||||||
import static google.registry.config.YamlUtils.getConfigSettings;
|
import static google.registry.config.YamlUtils.getConfigSettings;
|
||||||
import static google.registry.util.ResourceUtils.readResourceUtf8;
|
import static google.registry.util.ResourceUtils.readResourceUtf8;
|
||||||
|
|
||||||
|
import com.google.common.base.Ascii;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/** The POJO that YAML config files are deserialized into. */
|
/** The POJO that YAML config files are deserialized into. */
|
||||||
|
@ -120,7 +121,8 @@ public class ProxyConfig {
|
||||||
String customYaml =
|
String customYaml =
|
||||||
readResourceUtf8(
|
readResourceUtf8(
|
||||||
ProxyConfig.class,
|
ProxyConfig.class,
|
||||||
String.format(CUSTOM_CONFIG_FORMATTER, env.name().toLowerCase().replace("_", "-")));
|
String.format(
|
||||||
|
CUSTOM_CONFIG_FORMATTER, Ascii.toLowerCase(env.name()).replace("_", "-")));
|
||||||
return getConfigSettings(defaultYaml, customYaml, ProxyConfig.class);
|
return getConfigSettings(defaultYaml, customYaml, ProxyConfig.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import static java.nio.charset.StandardCharsets.UTF_8;
|
||||||
import com.beust.jcommander.Parameter;
|
import com.beust.jcommander.Parameter;
|
||||||
import com.beust.jcommander.Parameters;
|
import com.beust.jcommander.Parameters;
|
||||||
import com.beust.jcommander.internal.Sets;
|
import com.beust.jcommander.internal.Sets;
|
||||||
|
import com.google.common.base.Ascii;
|
||||||
import google.registry.model.domain.DomainApplication;
|
import google.registry.model.domain.DomainApplication;
|
||||||
import google.registry.model.domain.launch.ApplicationStatus;
|
import google.registry.model.domain.launch.ApplicationStatus;
|
||||||
import google.registry.tools.Command.RemoteApiCommand;
|
import google.registry.tools.Command.RemoteApiCommand;
|
||||||
|
@ -58,7 +59,7 @@ final class GetAppliedLabelsCommand implements RemoteApiCommand {
|
||||||
for (String label : getDomainApplicationMap(assertTldExists(tld))) {
|
for (String label : getDomainApplicationMap(assertTldExists(tld))) {
|
||||||
label = label.substring(0, label.lastIndexOf('.'));
|
label = label.substring(0, label.lastIndexOf('.'));
|
||||||
try {
|
try {
|
||||||
lines.add(Idn.toUnicode(label.toLowerCase()));
|
lines.add(Idn.toUnicode(Ascii.toLowerCase(label)));
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
// An invalid punycode label that we need to reject later.
|
// An invalid punycode label that we need to reject later.
|
||||||
lines.add(label + " (invalid)");
|
lines.add(label + " (invalid)");
|
||||||
|
|
|
@ -17,6 +17,7 @@ package google.registry.util;
|
||||||
import static com.google.common.base.Preconditions.checkArgument;
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
import static google.registry.util.CollectionUtils.union;
|
import static google.registry.util.CollectionUtils.union;
|
||||||
|
|
||||||
|
import com.google.common.base.Ascii;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.Inet6Address;
|
import java.net.Inet6Address;
|
||||||
|
@ -72,7 +73,7 @@ public final class NetworkUtils {
|
||||||
*/
|
*/
|
||||||
public static String getCanonicalHostName() {
|
public static String getCanonicalHostName() {
|
||||||
try {
|
try {
|
||||||
return getExternalAddressOfLocalSystem().getCanonicalHostName().toLowerCase();
|
return Ascii.toLowerCase(getExternalAddressOfLocalSystem().getCanonicalHostName());
|
||||||
} catch (UnknownHostException e) {
|
} catch (UnknownHostException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue