mirror of
https://github.com/google/nomulus.git
synced 2025-05-12 22:38:16 +02:00
Fix NPE in registry_tool when creating or updating a TLD with a dns writer
I forgot to inject the CreateTldCommand/UpdateTldCommand commands, which now need to be injected so that the list of available DnsWriter implementations is instantiated. This CL also adds a new DI Set<String> with just the name of the writer, so that the instantiated writer map (which may have many DI dependencies) doesn't need to be pulled in. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=130042215
This commit is contained in:
parent
0cab13e6d8
commit
e55ed209c5
6 changed files with 58 additions and 21 deletions
|
@ -15,7 +15,6 @@
|
|||
package google.registry.tools;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static google.registry.model.RoidSuffixes.isRoidSuffixUsed;
|
||||
import static google.registry.util.CollectionUtils.findDuplicates;
|
||||
import static google.registry.util.DomainNameUtils.canonicalizeDomainName;
|
||||
|
@ -27,7 +26,6 @@ import com.google.common.base.Optional;
|
|||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSortedMap;
|
||||
import google.registry.dns.writer.DnsWriter;
|
||||
import google.registry.model.pricing.StaticPremiumListPricingEngine;
|
||||
import google.registry.model.registry.Registries;
|
||||
import google.registry.model.registry.Registry;
|
||||
|
@ -43,6 +41,7 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import org.joda.money.Money;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.Duration;
|
||||
|
@ -50,11 +49,11 @@ import org.joda.time.Duration;
|
|||
/** Shared base class for commands to create or update a TLD. */
|
||||
abstract class CreateOrUpdateTldCommand extends MutatingCommand {
|
||||
|
||||
@Inject Map<String, DnsWriter> dnsWriters;
|
||||
@Inject
|
||||
@Named("dnsWriterNames")
|
||||
Set<String> dnsWriterNames;
|
||||
|
||||
@Parameter(
|
||||
description = "Names of the TLDs",
|
||||
required = true)
|
||||
@Parameter(description = "Names of the TLDs", required = true)
|
||||
List<String> mainParameters;
|
||||
|
||||
@Parameter(
|
||||
|
@ -384,8 +383,8 @@ abstract class CreateOrUpdateTldCommand extends MutatingCommand {
|
|||
|
||||
if (dnsWriter != null) {
|
||||
if (dnsWriter.isPresent()) {
|
||||
checkNotNull(
|
||||
dnsWriters.get(dnsWriter.get()),
|
||||
checkArgument(
|
||||
dnsWriterNames.contains(dnsWriter.get()),
|
||||
"The DNS writer '%s' doesn't exist",
|
||||
dnsWriter.get());
|
||||
builder.setDnsWriter(dnsWriter.get());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue