Replaces uses of java.net.IDN with our Idn stand in class

java.net.IDN uses outdated IDNA2003. We've created a replacement
class that uses the modern UTS46 transitional standard via the
IDNA library. This fixes uses of IDN in the RDAP code.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117243868
This commit is contained in:
cgoldfeder 2016-03-15 09:03:53 -07:00 committed by Justine Tunney
parent 46e02c6bd1
commit 5f7bf57cf9
3 changed files with 6 additions and 7 deletions

View file

@ -36,6 +36,7 @@ import com.google.domain.registry.request.HttpException.BadRequestException;
import com.google.domain.registry.request.HttpException.NotFoundException;
import com.google.domain.registry.request.Parameter;
import com.google.domain.registry.util.Clock;
import com.google.domain.registry.util.Idn;
import com.googlecode.objectify.Key;
import com.googlecode.objectify.Ref;
@ -44,7 +45,6 @@ import com.googlecode.objectify.cmd.QueryKeys;
import org.joda.time.DateTime;
import java.net.IDN;
import java.net.InetAddress;
import java.util.List;
@ -102,7 +102,7 @@ public class RdapDomainSearchAction extends RdapActionBase {
// TODO(b/24329745): improve IDN handling
String asciiName;
try {
asciiName = IDN.toASCII(nameParam.get());
asciiName = Idn.toASCII(nameParam.get());
} catch (Exception e) {
throw new BadRequestException("Invalid value of nsLdhName parameter");
}

View file

@ -40,8 +40,6 @@ import com.google.domain.registry.util.Clock;
import com.googlecode.objectify.Key;
import com.googlecode.objectify.cmd.Query;
import java.net.IDN;
import javax.inject.Inject;
/**
@ -93,7 +91,8 @@ public class RdapEntitySearchAction extends RdapActionBase {
throw new NotImplementedException("Entity name search not implemented");
} else {
// syntax: /rdap/entities?handle=12345-*
results = searchByHandle(RdapSearchPattern.create(IDN.toASCII(handleParam.get()), false));
// The handle is either the contact roid or the registrar clientId.
results = searchByHandle(RdapSearchPattern.create(handleParam.get(), false));
}
if (results.isEmpty()) {
throw new NotFoundException("No entities found");

View file

@ -35,12 +35,12 @@ import com.google.domain.registry.request.HttpException.BadRequestException;
import com.google.domain.registry.request.HttpException.NotFoundException;
import com.google.domain.registry.request.Parameter;
import com.google.domain.registry.util.Clock;
import com.google.domain.registry.util.Idn;
import com.googlecode.objectify.cmd.Query;
import org.joda.time.DateTime;
import java.net.IDN;
import java.net.InetAddress;
import javax.inject.Inject;
@ -98,7 +98,7 @@ public class RdapNameserverSearchAction extends RdapActionBase {
"Name parameter must contain only letters, dots"
+ " and hyphens, and an optional single wildcard");
}
results = searchByName(RdapSearchPattern.create(IDN.toASCII(nameParam.get()), true), now);
results = searchByName(RdapSearchPattern.create(Idn.toASCII(nameParam.get()), true), now);
} else {
// syntax: /rdap/nameservers?ip=1.2.3.4
results = searchByIp(ipParam.get());