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:
guyben 2018-04-19 07:29:32 -07:00 committed by jianglai
parent f289259101
commit 7bf8c02264
3 changed files with 7 additions and 3 deletions

View file

@ -23,6 +23,7 @@ import static java.nio.charset.StandardCharsets.UTF_8;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
import com.beust.jcommander.internal.Sets;
import com.google.common.base.Ascii;
import google.registry.model.domain.DomainApplication;
import google.registry.model.domain.launch.ApplicationStatus;
import google.registry.tools.Command.RemoteApiCommand;
@ -58,7 +59,7 @@ final class GetAppliedLabelsCommand implements RemoteApiCommand {
for (String label : getDomainApplicationMap(assertTldExists(tld))) {
label = label.substring(0, label.lastIndexOf('.'));
try {
lines.add(Idn.toUnicode(label.toLowerCase()));
lines.add(Idn.toUnicode(Ascii.toLowerCase(label)));
} catch (IllegalArgumentException e) {
// An invalid punycode label that we need to reject later.
lines.add(label + " (invalid)");