mirror of
https://github.com/google/nomulus.git
synced 2025-05-12 22:38:16 +02:00
Make Registrar load methods return Optionals instead of Nullables
This makes the code more understandable from callsites, and also forces users of this function to deal with the situation where the registrar with a given client ID might not be present (it was previously silently NPEing from some of the callsites). This also adds a test helper method loadRegistrar(clientId) that retains the old functionality for terseness in tests. It also fixes some instances of using the load method with the wrong cachedness -- some uses in high- traffic situations (WHOIS) that should have caching, but also low-traffic reporting that don't benefit from caching so might as well always be current. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=162990468
This commit is contained in:
parent
84fdeebc2f
commit
d536cef20f
81 changed files with 707 additions and 602 deletions
|
@ -20,6 +20,7 @@ import static google.registry.model.EppResourceUtils.loadDomainApplication;
|
|||
import static google.registry.model.domain.launch.ApplicationStatus.ALLOCATED;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.util.PreconditionsUtils.checkArgumentNotNull;
|
||||
import static google.registry.util.PreconditionsUtils.checkArgumentPresent;
|
||||
|
||||
import com.beust.jcommander.Parameter;
|
||||
import com.beust.jcommander.Parameters;
|
||||
|
@ -66,7 +67,7 @@ final class UpdateApplicationStatusCommand extends MutatingCommand {
|
|||
|
||||
@Override
|
||||
protected void init() throws Exception {
|
||||
checkArgumentNotNull(
|
||||
checkArgumentPresent(
|
||||
Registrar.loadByClientId(clientId), "Registrar with client ID %s not found", clientId);
|
||||
for (final String applicationId : ids) {
|
||||
ofy().transact(new VoidWork() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue