mirror of
https://github.com/google/nomulus
synced 2026-05-23 08:11:48 +00:00
Remove TLD parameters from WHOIS command factory methods
The small efficiency increase in not having to look up the TLDs again did not justify making the externally extensible API more complicated. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=145465971
This commit is contained in:
@@ -22,7 +22,6 @@ import static javax.servlet.http.HttpServletResponse.SC_NOT_FOUND;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.net.InternetDomainName;
|
||||
import javax.annotation.Nullable;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/** Represents a WHOIS lookup on a domain name (i.e. SLD) or a nameserver. */
|
||||
@@ -32,21 +31,15 @@ public abstract class DomainOrHostLookupCommand implements WhoisCommand {
|
||||
|
||||
private final String errorPrefix;
|
||||
|
||||
private Optional<InternetDomainName> tld;
|
||||
|
||||
DomainOrHostLookupCommand(
|
||||
InternetDomainName domainName, @Nullable InternetDomainName tld, String errorPrefix) {
|
||||
DomainOrHostLookupCommand(InternetDomainName domainName, String errorPrefix) {
|
||||
this.errorPrefix = errorPrefix;
|
||||
this.domainOrHostName = checkNotNull(domainName, "domainOrHostName");
|
||||
this.tld = Optional.fromNullable(tld);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final WhoisResponse executeQuery(final DateTime now) throws WhoisException {
|
||||
if (!tld.isPresent()) {
|
||||
tld = findTldForName(domainOrHostName);
|
||||
}
|
||||
// Google Policy: Do not return records under TLDs for which we're not authoritative.
|
||||
Optional<InternetDomainName> tld = findTldForName(domainOrHostName);
|
||||
// Google Registry Policy: Do not return records under TLDs for which we're not authoritative.
|
||||
if (tld.isPresent() && getTlds().contains(tld.get().toString())) {
|
||||
final Optional<WhoisResponse> response = getResponse(domainOrHostName, now);
|
||||
if (response.isPresent()) {
|
||||
|
||||
Reference in New Issue
Block a user