mirror of
https://github.com/google/nomulus.git
synced 2025-05-14 16:37:13 +02:00
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:
parent
d9596fa30c
commit
e72491e59b
22 changed files with 62 additions and 38 deletions
|
@ -14,6 +14,7 @@
|
|||
|
||||
package google.registry.model.domain.fee;
|
||||
|
||||
import com.google.common.base.Ascii;
|
||||
import com.google.common.base.CharMatcher;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
|
@ -56,7 +57,7 @@ public class FeeCommandDescriptor extends ImmutableObject {
|
|||
// Require the xml string to be lowercase.
|
||||
if (command != null && CharMatcher.javaLowerCase().matchesAllOf(command)) {
|
||||
try {
|
||||
return CommandName.valueOf(command.toUpperCase());
|
||||
return CommandName.valueOf(Ascii.toUpperCase(command));
|
||||
} catch (IllegalArgumentException e) {
|
||||
// Swallow this and return UNKNOWN below because there's no matching CommandName.
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ import static com.google.common.io.BaseEncoding.base16;
|
|||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
||||
|
||||
import com.google.common.base.Ascii;
|
||||
import com.google.common.base.CharMatcher;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.primitives.Ints;
|
||||
|
@ -101,7 +102,7 @@ public class LaunchNotice extends ImmutableObject {
|
|||
String tcnId = getNoticeId().getTcnId();
|
||||
checkArgument(tcnId.length() == 27);
|
||||
|
||||
int checksum = Ints.fromByteArray(base16().decode(tcnId.substring(0, 8).toUpperCase()));
|
||||
int checksum = Ints.fromByteArray(base16().decode(Ascii.toUpperCase(tcnId.substring(0, 8))));
|
||||
String noticeId = tcnId.substring(8);
|
||||
checkArgument(CharMatcher.inRange('0', '9').matchesAllOf(noticeId));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue