mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02:00
Make EppInput.getSingleExtension() return Optional, not @Nullable
This makes it harder to use it incorrectly by accident. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=181795813
This commit is contained in:
parent
fbdb148540
commit
315e6d57bf
21 changed files with 290 additions and 239 deletions
|
@ -151,13 +151,13 @@ public final class DomainCheckFlow implements Flow {
|
|||
.setAsOfDate(now)
|
||||
.build());
|
||||
Set<String> existingIds = checkResourcesExist(DomainResource.class, targetIds, now);
|
||||
AllocationTokenExtension allocationTokenExtension =
|
||||
Optional<AllocationTokenExtension> allocationTokenExtension =
|
||||
eppInput.getSingleExtension(AllocationTokenExtension.class);
|
||||
ImmutableMap<String, String> tokenCheckResults =
|
||||
(allocationTokenExtension == null)
|
||||
? ImmutableMap.of()
|
||||
: checkDomainsWithToken(
|
||||
targetIds, allocationTokenExtension.getAllocationToken(), clientId);
|
||||
allocationTokenExtension.isPresent()
|
||||
? checkDomainsWithToken(
|
||||
targetIds, allocationTokenExtension.get().getAllocationToken(), clientId)
|
||||
: ImmutableMap.of();
|
||||
ImmutableList.Builder<DomainCheck> checks = new ImmutableList.Builder<>();
|
||||
for (String targetId : targetIds) {
|
||||
Optional<String> message =
|
||||
|
@ -196,7 +196,7 @@ public final class DomainCheckFlow implements Flow {
|
|||
if (reservationTypes.isEmpty()
|
||||
&& isDomainPremium(domainName.toString(), now)
|
||||
&& registry.getPremiumPriceAckRequired()
|
||||
&& eppInput.getSingleExtension(FeeCheckCommandExtension.class) == null) {
|
||||
&& !eppInput.getSingleExtension(FeeCheckCommandExtension.class).isPresent()) {
|
||||
return Optional.of("Premium names require EPP ext.");
|
||||
}
|
||||
if (!reservationTypes.isEmpty()) {
|
||||
|
@ -210,11 +210,12 @@ public final class DomainCheckFlow implements Flow {
|
|||
/** Handle the fee check extension. */
|
||||
private ImmutableList<? extends ResponseExtension> getResponseExtensions(
|
||||
ImmutableMap<String, InternetDomainName> domainNames, DateTime now) throws EppException {
|
||||
FeeCheckCommandExtension<?, ?> feeCheck =
|
||||
Optional<FeeCheckCommandExtension> feeCheckOpt =
|
||||
eppInput.getSingleExtension(FeeCheckCommandExtension.class);
|
||||
if (feeCheck == null) {
|
||||
if (!feeCheckOpt.isPresent()) {
|
||||
return ImmutableList.of(); // No fee checks were requested.
|
||||
}
|
||||
FeeCheckCommandExtension<?, ?> feeCheck = feeCheckOpt.get();
|
||||
ImmutableList.Builder<FeeCheckResponseExtensionItem> responseItems =
|
||||
new ImmutableList.Builder<>();
|
||||
for (FeeCheckCommandExtensionItem feeCheckItem : feeCheck.getItems()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue