mirror of
https://github.com/google/nomulus
synced 2026-09-19 22:44:26 +00:00
Add assertTldsExist(Iterable<String>) to check multiple TLDs at once
This is better than calling assertTldExists() inside a for loop because you can throw a single exception reporting all bad TLDs at once rather than only getting as far as the first failure. And then it's also a one-liner instead of 3 lines. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=152412876
This commit is contained in:
@@ -29,7 +29,7 @@ import static google.registry.config.RegistryConfig.getDefaultRegistrarWhoisServ
|
||||
import static google.registry.model.common.EntityGroupRoot.getCrossTldKey;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.model.ofy.Ofy.RECOMMENDED_MEMCACHE_EXPIRATION;
|
||||
import static google.registry.model.registry.Registries.assertTldExists;
|
||||
import static google.registry.model.registry.Registries.assertTldsExist;
|
||||
import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
|
||||
import static google.registry.util.CollectionUtils.nullToEmptyImmutableSortedCopy;
|
||||
import static google.registry.util.X509Utils.getCertificateHash;
|
||||
@@ -670,10 +670,7 @@ public class Registrar extends ImmutableObject implements Buildable, Jsonifiable
|
||||
}
|
||||
|
||||
public Builder setAllowedTlds(Set<String> allowedTlds) {
|
||||
for (String tld : allowedTlds) {
|
||||
assertTldExists(tld);
|
||||
}
|
||||
getInstance().allowedTlds = ImmutableSortedSet.copyOf(allowedTlds);
|
||||
getInstance().allowedTlds = ImmutableSortedSet.copyOf(assertTldsExist(allowedTlds));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user