mirror of
https://github.com/google/nomulus
synced 2026-01-07 22:15:30 +00:00
Fix whitelist tests
Followups to [] ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=121993530
This commit is contained in:
committed by
Justine Tunney
parent
fc936ec2b0
commit
d1f34776d2
@@ -282,7 +282,9 @@ public class DomainFlowUtils {
|
||||
|
||||
/** Return a foreign key for a {@link ReferenceUnion} from memory or datastore as needed. */
|
||||
private static String resolveForeignKey(ReferenceUnion<?> ref) {
|
||||
return Optional.fromNullable(ref.getForeignKey()).or(ref.getLinked().get().getForeignKey());
|
||||
return ref.getForeignKey() != null
|
||||
? ref.getForeignKey()
|
||||
: ref.getLinked().get().getForeignKey();
|
||||
}
|
||||
|
||||
static void validateNameservers(String tld, Set<ReferenceUnion<HostResource>> nameservers)
|
||||
@@ -293,7 +295,7 @@ public class DomainFlowUtils {
|
||||
}
|
||||
ImmutableSet<String> whitelist = Registry.get(tld).getAllowedFullyQualifiedHostNames();
|
||||
if (!whitelist.isEmpty()) { // Empty whitelists are ignored.
|
||||
for (ReferenceUnion<HostResource> nameserver : nameservers) {
|
||||
for (ReferenceUnion<HostResource> nameserver : nullToEmpty(nameservers)) {
|
||||
String foreignKey = resolveForeignKey(nameserver);
|
||||
if (!whitelist.contains(foreignKey)) {
|
||||
throw new NameserverNotAllowedException(foreignKey);
|
||||
@@ -336,7 +338,7 @@ public class DomainFlowUtils {
|
||||
ImmutableSet<String> whitelist = Registry.get(tld).getAllowedRegistrantContactIds();
|
||||
// Empty whitelists are ignored.
|
||||
if (!whitelist.isEmpty() && !whitelist.contains(resolveForeignKey(registrant))) {
|
||||
throw new RegistrantNotAllowedException(registrant.toString());
|
||||
throw new RegistrantNotAllowedException(resolveForeignKey(registrant));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user