Fix a few deprecations (#186)

This commit is contained in:
gbrodman 2019-07-22 14:12:55 -04:00 committed by GitHub
parent 97e4b26467
commit cdb94ba24f
3 changed files with 5 additions and 6 deletions

View file

@ -15,9 +15,9 @@
package google.registry.model.domain.fee; package google.registry.model.domain.fee;
import com.google.common.base.Ascii; import com.google.common.base.Ascii;
import com.google.common.base.CharMatcher;
import google.registry.model.ImmutableObject; import google.registry.model.ImmutableObject;
import google.registry.model.domain.fee.FeeQueryCommandExtensionItem.CommandName; import google.registry.model.domain.fee.FeeQueryCommandExtensionItem.CommandName;
import java.util.Locale;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlValue; import javax.xml.bind.annotation.XmlValue;
@ -47,7 +47,7 @@ public class FeeExtensionCommandDescriptor extends ImmutableObject {
public CommandName getCommand() { public CommandName getCommand() {
// Require the xml string to be lowercase. // Require the xml string to be lowercase.
if (command != null && CharMatcher.javaLowerCase().matchesAllOf(command)) { if (command != null && command.toLowerCase(Locale.ENGLISH).equals(command)) {
try { try {
return CommandName.valueOf(Ascii.toUpperCase(command)); return CommandName.valueOf(Ascii.toUpperCase(command));
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {

View file

@ -15,9 +15,9 @@
package google.registry.model.domain.fee12; package google.registry.model.domain.fee12;
import com.google.common.base.Ascii; import com.google.common.base.Ascii;
import com.google.common.base.CharMatcher;
import google.registry.model.domain.Period; import google.registry.model.domain.Period;
import google.registry.model.domain.fee.FeeCheckCommandExtensionItem; import google.registry.model.domain.fee.FeeCheckCommandExtensionItem;
import java.util.Locale;
import java.util.Optional; import java.util.Optional;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
@ -83,7 +83,7 @@ public class FeeCheckCommandExtensionItemV12 extends FeeCheckCommandExtensionIte
@Override @Override
public CommandName getCommandName() { public CommandName getCommandName() {
// Require the xml string to be lowercase. // Require the xml string to be lowercase.
if (commandName != null && CharMatcher.javaLowerCase().matchesAllOf(commandName)) { if (commandName != null && commandName.toLowerCase(Locale.ENGLISH).equals(commandName)) {
try { try {
return CommandName.valueOf(Ascii.toUpperCase(commandName)); return CommandName.valueOf(Ascii.toUpperCase(commandName));
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {

View file

@ -19,7 +19,6 @@ import static google.registry.util.CollectionUtils.findDuplicates;
import static google.registry.util.DomainNameUtils.canonicalizeDomainName; import static google.registry.util.DomainNameUtils.canonicalizeDomainName;
import com.beust.jcommander.Parameter; import com.beust.jcommander.Parameter;
import com.google.common.base.CharMatcher;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
@ -255,7 +254,7 @@ abstract class CreateOrUpdateTldCommand extends MutatingCommand {
tld, tld,
canonicalizeDomainName(tld)); canonicalizeDomainName(tld));
checkArgument( checkArgument(
!CharMatcher.javaDigit().matches(tld.charAt(0)), !Character.isDigit(tld.charAt(0)),
"TLDs cannot begin with a number"); "TLDs cannot begin with a number");
Registry oldRegistry = getOldRegistry(tld); Registry oldRegistry = getOldRegistry(tld);
// TODO(b/26901539): Add a flag to set the pricing engine once we have more than one option. // TODO(b/26901539): Add a flag to set the pricing engine once we have more than one option.