From 13fd9971a9202ae3e623abbb8d4561d29731d88c Mon Sep 17 00:00:00 2001 From: Weimin Yu Date: Thu, 15 Apr 2021 16:15:01 -0400 Subject: [PATCH] Use lazy injection in SendEscrow command (#1086) * Use lazy injection in SendEscrow command The injected object in SendEscrowReportToIcannCommand creates Ofy keys in its static initialization routine. This happens before the RemoteApi setup. Use lazy injection to prevent failure. --- .../registry/tools/SendEscrowReportToIcannCommand.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/google/registry/tools/SendEscrowReportToIcannCommand.java b/core/src/main/java/google/registry/tools/SendEscrowReportToIcannCommand.java index 7a0dd5ecc..7cfd1870e 100644 --- a/core/src/main/java/google/registry/tools/SendEscrowReportToIcannCommand.java +++ b/core/src/main/java/google/registry/tools/SendEscrowReportToIcannCommand.java @@ -16,6 +16,7 @@ package google.registry.tools; import com.beust.jcommander.Parameter; import com.beust.jcommander.Parameters; +import dagger.Lazy; import google.registry.rde.RdeReporter; import google.registry.tools.params.PathParameter; import java.nio.file.Files; @@ -33,13 +34,12 @@ final class SendEscrowReportToIcannCommand implements CommandWithRemoteApi { required = true) private List files; - @Inject - RdeReporter rdeReporter; + @Inject Lazy rdeReporter; @Override public void run() throws Exception { for (Path file : files) { - rdeReporter.send(Files.readAllBytes(file)); + rdeReporter.get().send(Files.readAllBytes(file)); System.out.printf("Uploaded: %s\n", file); } }