mirror of
https://github.com/google/nomulus.git
synced 2025-06-27 06:44:51 +02:00
Make async flow logic handle missing client transaction IDs
Per EPP RFC 5730, the <clTRID> element is optional. However, we weren't handling it not being specified in asynchronous contact/host deletions because we were adding it directly as a parameter value on a task, which does not allow null and thus threw a NullPointerException. This fixes handling for nulls (the parameter isn't set at all) and adds a test. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=194123259
This commit is contained in:
parent
f56355c9e8
commit
33505f4df7
16 changed files with 196 additions and 47 deletions
|
@ -92,6 +92,7 @@ import google.registry.util.SystemClock;
|
|||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import org.joda.time.DateTime;
|
||||
|
@ -379,7 +380,7 @@ public class DeleteContactsAndHostsAction implements Runnable {
|
|||
EppResource resource,
|
||||
boolean deleteAllowed,
|
||||
DateTime now) {
|
||||
String clientTransactionId = deletionRequest.clientTransactionId();
|
||||
@Nullable String clientTransactionId = deletionRequest.clientTransactionId();
|
||||
String serverTransactionId = deletionRequest.serverTransactionId();
|
||||
Trid trid = Trid.create(clientTransactionId, serverTransactionId);
|
||||
if (resource instanceof HostResource) {
|
||||
|
@ -445,6 +446,7 @@ public class DeleteContactsAndHostsAction implements Runnable {
|
|||
|
||||
abstract Key<? extends EppResource> key();
|
||||
abstract DateTime lastUpdateTime();
|
||||
|
||||
/**
|
||||
* The client id of the registrar that requested this deletion (which might NOT be the same as
|
||||
* the actual current owner of the resource).
|
||||
|
@ -452,6 +454,7 @@ public class DeleteContactsAndHostsAction implements Runnable {
|
|||
abstract String requestingClientId();
|
||||
|
||||
/** First half of TRID for the original request, split for serializability. */
|
||||
@Nullable
|
||||
abstract String clientTransactionId();
|
||||
|
||||
/** Second half of TRID for the original request, split for serializability. */
|
||||
|
@ -467,7 +470,7 @@ public class DeleteContactsAndHostsAction implements Runnable {
|
|||
abstract Builder setKey(Key<? extends EppResource> key);
|
||||
abstract Builder setLastUpdateTime(DateTime lastUpdateTime);
|
||||
abstract Builder setRequestingClientId(String requestingClientId);
|
||||
abstract Builder setClientTransactionId(String clientTransactionId);
|
||||
abstract Builder setClientTransactionId(@Nullable String clientTransactionId);
|
||||
abstract Builder setServerTransactionId(String serverTransactionId);
|
||||
abstract Builder setIsSuperuser(boolean isSuperuser);
|
||||
abstract Builder setRequestedTime(DateTime requestedTime);
|
||||
|
@ -494,9 +497,8 @@ public class DeleteContactsAndHostsAction implements Runnable {
|
|||
.setRequestingClientId(
|
||||
checkNotNull(
|
||||
params.get(PARAM_REQUESTING_CLIENT_ID), "Requesting client id not specified"))
|
||||
.setClientTransactionId(
|
||||
checkNotNull(
|
||||
params.get(PARAM_CLIENT_TRANSACTION_ID), "Client transaction id not specified"))
|
||||
// Note that client transaction ID is optional, in which case this sets it to null.
|
||||
.setClientTransactionId(params.get(PARAM_CLIENT_TRANSACTION_ID))
|
||||
.setServerTransactionId(
|
||||
checkNotNull(
|
||||
params.get(PARAM_SERVER_TRANSACTION_ID), "Server transaction id not specified"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue