mirror of
https://github.com/google/nomulus.git
synced 2025-05-31 17:54:08 +02:00
Unify two exceptions that mean the same thing
These were historically separate due to the old flow structure, but now they should be one exception. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=133984858
This commit is contained in:
parent
21a98b899c
commit
096877f03e
55 changed files with 163 additions and 211 deletions
|
@ -42,7 +42,7 @@ import javax.inject.Inject;
|
|||
* @error {@link google.registry.flows.ResourceFlow.BadCommandForRegistryPhaseException}
|
||||
* @error {@link google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException}
|
||||
* @error {@link google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException}
|
||||
* @error {@link google.registry.flows.ResourceMutateFlow.ResourceToMutateDoesNotExistException}
|
||||
* @error {@link google.registry.flows.ResourceMutateFlow.ResourceDoesNotExistException}
|
||||
* @error {@link DomainApplicationDeleteFlow.SunriseApplicationCannotBeDeletedInLandrushException}
|
||||
* @error {@link DomainFlowUtils.ApplicationDomainNameMismatchException}
|
||||
* @error {@link DomainFlowUtils.LaunchPhaseMismatchException}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
package google.registry.flows.domain;
|
||||
|
||||
import static google.registry.flows.EppXmlTransformer.unmarshal;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyExistence;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfoForResource;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyResourceOwnership;
|
||||
import static google.registry.flows.domain.DomainFlowUtils.addSecDnsExtensionIfPresent;
|
||||
|
@ -31,7 +32,6 @@ import google.registry.flows.FlowModule.ApplicationId;
|
|||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.TargetId;
|
||||
import google.registry.flows.LoggedInFlow;
|
||||
import google.registry.flows.exceptions.ResourceToQueryDoesNotExistException;
|
||||
import google.registry.model.domain.DomainApplication;
|
||||
import google.registry.model.domain.DomainCommand.Info;
|
||||
import google.registry.model.domain.launch.LaunchInfoExtension;
|
||||
|
@ -51,8 +51,8 @@ import javax.inject.Inject;
|
|||
* <p>Only the registrar that owns the application can see its info. The flow can optionally include
|
||||
* delegated hosts in its response.
|
||||
*
|
||||
* @error {@link google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException}
|
||||
* @error {@link google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException}
|
||||
* @error {@link google.registry.flows.exceptions.ResourceToQueryDoesNotExistException}
|
||||
* @error {@link DomainFlowUtils.ApplicationDomainNameMismatchException}
|
||||
* @error {@link DomainApplicationInfoFlow.ApplicationLaunchPhaseMismatchException}
|
||||
* @error {@link MissingApplicationIdException}
|
||||
|
@ -76,10 +76,8 @@ public final class DomainApplicationInfoFlow extends LoggedInFlow {
|
|||
if (applicationId.isEmpty()) {
|
||||
throw new MissingApplicationIdException();
|
||||
}
|
||||
DomainApplication application = loadDomainApplication(applicationId, now);
|
||||
if (application == null) {
|
||||
throw new ResourceToQueryDoesNotExistException(DomainApplication.class, applicationId);
|
||||
}
|
||||
DomainApplication application = verifyExistence(
|
||||
DomainApplication.class, applicationId, loadDomainApplication(applicationId, now));
|
||||
verifyApplicationDomainMatchesTargetId(application, targetId);
|
||||
verifyOptionalAuthInfoForResource(authInfo, application);
|
||||
LaunchInfoExtension launchInfo = eppInput.getSingleExtension(LaunchInfoExtension.class);
|
||||
|
|
|
@ -36,7 +36,7 @@ import javax.inject.Inject;
|
|||
* @error {@link google.registry.flows.EppException.UnimplementedExtensionException}
|
||||
* @error {@link google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException}
|
||||
* @error {@link google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException}
|
||||
* @error {@link google.registry.flows.ResourceMutateFlow.ResourceToMutateDoesNotExistException}
|
||||
* @error {@link google.registry.flows.ResourceMutateFlow.ResourceDoesNotExistException}
|
||||
* @error {@link google.registry.flows.ResourceUpdateFlow.AddRemoveSameValueEppException}
|
||||
* @error {@link google.registry.flows.ResourceUpdateFlow.ResourceHasClientUpdateProhibitedException}
|
||||
* @error {@link google.registry.flows.ResourceUpdateFlow.StatusNotClientSettableException}
|
||||
|
|
|
@ -66,7 +66,7 @@ import org.joda.time.DateTime;
|
|||
* @error {@link google.registry.flows.ResourceCreateOrMutateFlow.OnlyToolCanPassMetadataException}
|
||||
* @error {@link google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException}
|
||||
* @error {@link google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException}
|
||||
* @error {@link google.registry.flows.ResourceMutateFlow.ResourceToMutateDoesNotExistException}
|
||||
* @error {@link google.registry.flows.ResourceMutateFlow.ResourceDoesNotExistException}
|
||||
* @error {@link google.registry.flows.SingleResourceFlow.ResourceStatusProhibitsOperationException}
|
||||
* @error {@link DomainDeleteFlow.DomainToDeleteHasHostsException}
|
||||
*/
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
package google.registry.flows.domain;
|
||||
|
||||
import static google.registry.flows.ResourceFlowUtils.loadResourceForQuery;
|
||||
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfoForResource;
|
||||
import static google.registry.flows.domain.DomainFlowUtils.addSecDnsExtensionIfPresent;
|
||||
import static google.registry.flows.domain.DomainFlowUtils.handleFeeRequest;
|
||||
|
@ -53,7 +53,7 @@ import javax.inject.Inject;
|
|||
* answered with a minimal result containing only basic information about the domain.
|
||||
*
|
||||
* @error {@link google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException}
|
||||
* @error {@link google.registry.flows.exceptions.ResourceToQueryDoesNotExistException}
|
||||
* @error {@link google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException}
|
||||
* @error {@link DomainFlowUtils.BadPeriodUnitException}
|
||||
* @error {@link DomainFlowUtils.CurrencyUnitMismatchException}
|
||||
* @error {@link DomainFlowUtils.FeeChecksDontSupportPhasesException}
|
||||
|
@ -74,7 +74,7 @@ public final class DomainInfoFlow extends LoggedInFlow {
|
|||
|
||||
@Override
|
||||
public final EppOutput run() throws EppException {
|
||||
DomainResource domain = loadResourceForQuery(DomainResource.class, targetId, now);
|
||||
DomainResource domain = loadAndVerifyExistence(DomainResource.class, targetId, now);
|
||||
verifyOptionalAuthInfoForResource(authInfo, domain);
|
||||
return createOutput(
|
||||
SUCCESS,
|
||||
|
|
|
@ -63,7 +63,7 @@ import org.joda.time.DateTime;
|
|||
*
|
||||
* @error {@link google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException}
|
||||
* @error {@link google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException}
|
||||
* @error {@link google.registry.flows.ResourceMutateFlow.ResourceToMutateDoesNotExistException}
|
||||
* @error {@link google.registry.flows.ResourceMutateFlow.ResourceDoesNotExistException}
|
||||
* @error {@link google.registry.flows.SingleResourceFlow.ResourceStatusProhibitsOperationException}
|
||||
* @error {@link DomainFlowUtils.BadPeriodUnitException}
|
||||
* @error {@link DomainFlowUtils.CurrencyUnitMismatchException}
|
||||
|
|
|
@ -60,7 +60,7 @@ import org.joda.time.DateTime;
|
|||
* @error {@link google.registry.flows.EppException.UnimplementedExtensionException}
|
||||
* @error {@link google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException}
|
||||
* @error {@link google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException}
|
||||
* @error {@link google.registry.flows.ResourceMutateFlow.ResourceToMutateDoesNotExistException}
|
||||
* @error {@link google.registry.flows.ResourceMutateFlow.ResourceDoesNotExistException}
|
||||
* @error {@link DomainFlowUtils.CurrencyUnitMismatchException}
|
||||
* @error {@link DomainFlowUtils.CurrencyValueScaleException}
|
||||
* @error {@link DomainFlowUtils.DomainReservedException}
|
||||
|
|
|
@ -17,7 +17,7 @@ package google.registry.flows.domain;
|
|||
import static com.google.common.collect.Iterables.filter;
|
||||
import static com.google.common.collect.Iterables.getOnlyElement;
|
||||
import static google.registry.flows.ResourceFlowUtils.approvePendingTransfer;
|
||||
import static google.registry.flows.ResourceFlowUtils.loadResourceToMutate;
|
||||
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyHasPendingTransfer;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfoForResource;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyResourceOwnership;
|
||||
|
@ -71,9 +71,9 @@ import org.joda.time.DateTime;
|
|||
* those speculative objects are deleted and replaced with new ones with the correct approval time.
|
||||
*
|
||||
* @error {@link google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException}
|
||||
* @error {@link google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException}
|
||||
* @error {@link google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException}
|
||||
* @error {@link google.registry.flows.exceptions.NotPendingTransferException}
|
||||
* @error {@link google.registry.flows.exceptions.ResourceToMutateDoesNotExistException}
|
||||
* @error {@link DomainFlowUtils.NotAuthorizedForTldException}
|
||||
*/
|
||||
public final class DomainTransferApproveFlow extends LoggedInFlow implements TransactionalFlow {
|
||||
|
@ -95,7 +95,7 @@ public final class DomainTransferApproveFlow extends LoggedInFlow implements Tra
|
|||
*/
|
||||
@Override
|
||||
public final EppOutput run() throws EppException {
|
||||
DomainResource existingDomain = loadResourceToMutate(DomainResource.class, targetId, now);
|
||||
DomainResource existingDomain = loadAndVerifyExistence(DomainResource.class, targetId, now);
|
||||
verifyOptionalAuthInfoForResource(authInfo, existingDomain);
|
||||
verifyHasPendingTransfer(existingDomain);
|
||||
verifyResourceOwnership(clientId, existingDomain);
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
package google.registry.flows.domain;
|
||||
|
||||
import static google.registry.flows.ResourceFlowUtils.denyPendingTransfer;
|
||||
import static google.registry.flows.ResourceFlowUtils.loadResourceToMutate;
|
||||
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyHasPendingTransfer;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyIsGainingRegistrar;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfoForResource;
|
||||
|
@ -56,9 +56,9 @@ import javax.inject.Inject;
|
|||
* those speculative objects are deleted.
|
||||
*
|
||||
* @error {@link google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException}
|
||||
* @error {@link google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException}
|
||||
* @error {@link google.registry.flows.exceptions.NotPendingTransferException}
|
||||
* @error {@link google.registry.flows.exceptions.NotTransferInitiatorException}
|
||||
* @error {@link google.registry.flows.exceptions.ResourceToMutateDoesNotExistException}
|
||||
* @error {@link DomainFlowUtils.NotAuthorizedForTldException}
|
||||
*/
|
||||
public final class DomainTransferCancelFlow extends LoggedInFlow implements TransactionalFlow {
|
||||
|
@ -76,7 +76,7 @@ public final class DomainTransferCancelFlow extends LoggedInFlow implements Tran
|
|||
|
||||
@Override
|
||||
public final EppOutput run() throws EppException {
|
||||
DomainResource existingDomain = loadResourceToMutate(DomainResource.class, targetId, now);
|
||||
DomainResource existingDomain = loadAndVerifyExistence(DomainResource.class, targetId, now);
|
||||
verifyOptionalAuthInfoForResource(authInfo, existingDomain);
|
||||
verifyHasPendingTransfer(existingDomain);
|
||||
verifyIsGainingRegistrar(existingDomain, clientId);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
package google.registry.flows.domain;
|
||||
|
||||
import static google.registry.flows.ResourceFlowUtils.loadResourceForQuery;
|
||||
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfoForResource;
|
||||
import static google.registry.flows.domain.DomainFlowUtils.createTransferResponse;
|
||||
import static google.registry.model.domain.DomainResource.extendRegistrationWithCap;
|
||||
|
@ -46,9 +46,9 @@ import org.joda.time.DateTime;
|
|||
* period expiring.
|
||||
*
|
||||
* @error {@link google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException}
|
||||
* @error {@link google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException}
|
||||
* @error {@link google.registry.flows.exceptions.NoTransferHistoryToQueryException}
|
||||
* @error {@link google.registry.flows.exceptions.NotAuthorizedToViewTransferException}
|
||||
* @error {@link google.registry.flows.exceptions.ResourceToQueryDoesNotExistException}
|
||||
*/
|
||||
public final class DomainTransferQueryFlow extends LoggedInFlow {
|
||||
|
||||
|
@ -59,7 +59,7 @@ public final class DomainTransferQueryFlow extends LoggedInFlow {
|
|||
|
||||
@Override
|
||||
public final EppOutput run() throws EppException {
|
||||
DomainResource domain = loadResourceForQuery(DomainResource.class, targetId, now);
|
||||
DomainResource domain = loadAndVerifyExistence(DomainResource.class, targetId, now);
|
||||
verifyOptionalAuthInfoForResource(authInfo, domain);
|
||||
// Most of the fields on the transfer response are required, so there's no way to return valid
|
||||
// XML if the object has never been transferred (and hence the fields aren't populated).
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
package google.registry.flows.domain;
|
||||
|
||||
import static google.registry.flows.ResourceFlowUtils.denyPendingTransfer;
|
||||
import static google.registry.flows.ResourceFlowUtils.loadResourceToMutate;
|
||||
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyHasPendingTransfer;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfoForResource;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyResourceOwnership;
|
||||
|
@ -56,9 +56,9 @@ import javax.inject.Inject;
|
|||
* those speculative objects are deleted.
|
||||
*
|
||||
* @error {@link google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException}
|
||||
* @error {@link google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException}
|
||||
* @error {@link google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException}
|
||||
* @error {@link google.registry.flows.exceptions.NotPendingTransferException}
|
||||
* @error {@link google.registry.flows.exceptions.ResourceToMutateDoesNotExistException}
|
||||
* @error {@link DomainFlowUtils.NotAuthorizedForTldException}
|
||||
*/
|
||||
public final class DomainTransferRejectFlow extends LoggedInFlow implements TransactionalFlow {
|
||||
|
@ -76,7 +76,7 @@ public final class DomainTransferRejectFlow extends LoggedInFlow implements Tran
|
|||
|
||||
@Override
|
||||
public final EppOutput run() throws EppException {
|
||||
DomainResource existingDomain = loadResourceToMutate(DomainResource.class, targetId, now);
|
||||
DomainResource existingDomain = loadAndVerifyExistence(DomainResource.class, targetId, now);
|
||||
HistoryEntry historyEntry = historyBuilder
|
||||
.setType(HistoryEntry.Type.DOMAIN_TRANSFER_REJECT)
|
||||
.setModificationTime(now)
|
||||
|
|
|
@ -17,7 +17,7 @@ package google.registry.flows.domain;
|
|||
import static com.google.common.collect.Iterables.filter;
|
||||
import static com.google.common.collect.Iterables.getOnlyElement;
|
||||
import static com.google.common.collect.Sets.union;
|
||||
import static google.registry.flows.ResourceFlowUtils.loadResourceToMutate;
|
||||
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyNoDisallowedStatuses;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyRequiredAuthInfoForResourceTransfer;
|
||||
import static google.registry.flows.domain.DomainFlowUtils.checkAllowedAccessToTld;
|
||||
|
@ -91,11 +91,11 @@ import org.joda.time.DateTime;
|
|||
* replaced with new ones with the correct approval time).
|
||||
*
|
||||
* @error {@link google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException}
|
||||
* @error {@link google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException}
|
||||
* @error {@link google.registry.flows.exceptions.AlreadyPendingTransferException}
|
||||
* @error {@link google.registry.flows.exceptions.MissingTransferRequestAuthInfoException}
|
||||
* @error {@link google.registry.flows.exceptions.ObjectAlreadySponsoredException}
|
||||
* @error {@link google.registry.flows.exceptions.ResourceStatusProhibitsOperationException}
|
||||
* @error {@link google.registry.flows.exceptions.ResourceToMutateDoesNotExistException}
|
||||
* @error {@link DomainFlowUtils.BadPeriodUnitException}
|
||||
* @error {@link DomainFlowUtils.CurrencyUnitMismatchException}
|
||||
* @error {@link DomainFlowUtils.CurrencyValueScaleException}
|
||||
|
@ -129,7 +129,7 @@ public final class DomainTransferRequestFlow extends LoggedInFlow implements Tra
|
|||
public final EppOutput run() throws EppException {
|
||||
Period period = ((Transfer) resourceCommand).getPeriod();
|
||||
int years = period.getValue();
|
||||
DomainResource existingDomain = loadResourceToMutate(DomainResource.class, targetId, now);
|
||||
DomainResource existingDomain = loadAndVerifyExistence(DomainResource.class, targetId, now);
|
||||
verifyTransferAllowed(existingDomain, period);
|
||||
String tld = existingDomain.getTld();
|
||||
Registry registry = Registry.get(tld);
|
||||
|
|
|
@ -48,7 +48,7 @@ import org.joda.time.DateTime;
|
|||
* @error {@link google.registry.flows.ResourceCreateOrMutateFlow.OnlyToolCanPassMetadataException}
|
||||
* @error {@link google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException}
|
||||
* @error {@link google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException}
|
||||
* @error {@link google.registry.flows.ResourceMutateFlow.ResourceToMutateDoesNotExistException}
|
||||
* @error {@link google.registry.flows.ResourceMutateFlow.ResourceDoesNotExistException}
|
||||
* @error {@link google.registry.flows.ResourceUpdateFlow.AddRemoveSameValueEppException}
|
||||
* @error {@link google.registry.flows.ResourceUpdateFlow.ResourceHasClientUpdateProhibitedException}
|
||||
* @error {@link google.registry.flows.ResourceUpdateFlow.StatusNotClientSettableException}
|
||||
|
|
|
@ -25,7 +25,7 @@ import com.google.common.base.Optional;
|
|||
import com.google.common.collect.ImmutableList;
|
||||
import com.googlecode.objectify.Key;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ResourceMutateFlow.ResourceToMutateDoesNotExistException;
|
||||
import google.registry.flows.ResourceMutateFlow.ResourceDoesNotExistException;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.domain.DomainCommand.Create;
|
||||
import google.registry.model.domain.DomainResource;
|
||||
|
@ -183,7 +183,7 @@ public final class TldSpecificLogicProxy {
|
|||
// TODO: Consider changing the method definition to have the domain passed in to begin with.
|
||||
DomainResource domain = loadByForeignKey(DomainResource.class, domainName, date);
|
||||
if (domain == null) {
|
||||
throw new ResourceToMutateDoesNotExistException(DomainResource.class, domainName);
|
||||
throw new ResourceDoesNotExistException(DomainResource.class, domainName);
|
||||
}
|
||||
return
|
||||
extraFlowLogic.get().getRenewFeeOrCredit(domain, clientId, date, years, eppInput);
|
||||
|
@ -249,7 +249,7 @@ public final class TldSpecificLogicProxy {
|
|||
// TODO: Consider changing the method definition to have the domain passed in to begin with.
|
||||
DomainResource domain = loadByForeignKey(DomainResource.class, domainName, date);
|
||||
if (domain == null) {
|
||||
throw new ResourceToMutateDoesNotExistException(DomainResource.class, domainName);
|
||||
throw new ResourceDoesNotExistException(DomainResource.class, domainName);
|
||||
}
|
||||
feeOrCredit =
|
||||
extraFlowLogic.get().getUpdateFeeOrCredit(domain, clientId, date, eppInput);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue