Replace to(Upper|Lower)Case with Ascii.to$1Case

The presubmits are warning that toUpperCase() and toLowerCase() are locale-specific, and advise using Ascii.toUpperCase() and Ascii.toLowerCase() as a local-invariant alternative.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=127583677
This commit is contained in:
mountford 2016-07-15 15:10:13 -07:00 committed by Ben McIlwain
parent d9596fa30c
commit e72491e59b
22 changed files with 62 additions and 38 deletions

View file

@ -16,11 +16,13 @@ package google.registry.util;
import static com.google.common.base.CharMatcher.javaLetterOrDigit;
import com.google.common.base.Ascii;
/** Utilities for working with {@code Registrar} objects. */
public class RegistrarUtils {
/** Strip out anything that isn't a letter or digit, and lowercase. */
public static String normalizeRegistrarName(String name) {
return javaLetterOrDigit().retainFrom(name).toLowerCase();
return Ascii.toLowerCase(javaLetterOrDigit().retainFrom(name));
}
/**
@ -29,6 +31,6 @@ public class RegistrarUtils {
* in Datastore, and is suitable for use in email addresses.
*/
public static String normalizeClientId(String clientId) {
return clientId.toLowerCase().replaceAll("[^a-z0-9\\-]", "");
return Ascii.toLowerCase(clientId).replaceAll("[^a-z0-9\\-]", "");
}
}