From a500812a91b012acb867e224e7bea6b3f66ddc4c Mon Sep 17 00:00:00 2001 From: nickfelt Date: Tue, 11 Oct 2016 14:36:07 -0700 Subject: [PATCH] Remove overly broad try-catch in BaseDomainCreateFlow.createFlowRepoId() This bit Hans as described in https://groups.google.com/d/topic/nomulus-discuss/o897-hRP_3c/discussion ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=135842526 --- .../registry/flows/domain/BaseDomainCreateFlow.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/java/google/registry/flows/domain/BaseDomainCreateFlow.java b/java/google/registry/flows/domain/BaseDomainCreateFlow.java index d29d2961e..d85043c2f 100644 --- a/java/google/registry/flows/domain/BaseDomainCreateFlow.java +++ b/java/google/registry/flows/domain/BaseDomainCreateFlow.java @@ -118,15 +118,14 @@ public abstract class BaseDomainCreateFlow tldParsed = - findTldForName(InternetDomainName.from(command.getFullyQualifiedDomainName())); - return tldParsed.isPresent() - ? createDomainRoid(ObjectifyService.allocateId(), tldParsed.get().toString()) - : null; - } catch (IllegalArgumentException e) { + if (!InternetDomainName.isValid(command.getFullyQualifiedDomainName())) { return null; } + Optional tldParsed = + findTldForName(InternetDomainName.from(command.getFullyQualifiedDomainName())); + return tldParsed.isPresent() + ? createDomainRoid(ObjectifyService.allocateId(), tldParsed.get().toString()) + : null; } /** Subclasses may override this to do more specific initialization. */