1
0
mirror of https://github.com/google/nomulus synced 2026-02-04 12:02:30 +00:00

Replace deprecated CharMatcher method

CharMatcher.isLetterOrDigit() is deprecated for failing to support
supplementary characters. We explicitly declare a matcher for ascii
letters and digits.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=252671830
This commit is contained in:
weiminyu
2019-06-11 12:16:16 -07:00
committed by jianglai
parent 00c7c0f1af
commit d7da7f6da4
4 changed files with 76 additions and 3 deletions

View File

@@ -14,15 +14,19 @@
package google.registry.util;
import static com.google.common.base.CharMatcher.javaLetterOrDigit;
import com.google.common.base.Ascii;
import com.google.common.base.CharMatcher;
/** Utilities for working with {@code Registrar} objects. */
public class RegistrarUtils {
private static final CharMatcher ASCII_LETTER_OR_DIGIT_MATCHER =
JavaCharMatchers.asciiLetterOrDigitMatcher();
/** Strip out anything that isn't a letter or digit, and lowercase. */
public static String normalizeRegistrarName(String name) {
return Ascii.toLowerCase(javaLetterOrDigit().retainFrom(name));
return Ascii.toLowerCase(ASCII_LETTER_OR_DIGIT_MATCHER.retainFrom(name));
}
/**