commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <ralph.go...@dslextreme.com>
Subject Re: [validator] EmailValidator accept empty domain names
Date Sun, 25 Oct 2015 07:07:21 GMT
Please see VALIDATOR-376. I just committed the fix for this. FYI - commons-validator 1.4 does
not have this behavior.

Ralph



> On Oct 22, 2015, at 12:05 AM, S├ębastien De Nef <sebastien.denef@gmail.com> wrote:
> 
> Hi everybody,
> 
> First, sorry for my english.
> 
> I tried the EmailValidator component and I was surprised that it accepts a
> domain part that contains only the TLD (like joe@.org). See below a failing
> test.
> 
> Although domainValidator.isValid(domain) returns false
> domainValidator.isValid(domain) || domainValidator.isValidTld(domain)
> returns true
> Is it the source of the problem ? Why does it bypass the domain validation
> if the TLD is valid ?
> NB: DomainValidator.isValid already contains isValidTld()
> 
> S├ębastien
> 
> /**
> * Tests the email validation for empty domain.
> */
> public void testEmailWithEmptyDomain()  {
>    assertFalse("empty domain name should fail",
> emailValidator.commonsValidator("joe@"));
>    assertFalse("domain name starting with dot should fail",
> emailValidator.commonsValidator("joe@.apache.org"));
>    assertFalse("domain name with only TLD should fail",
> emailValidator.commonsValidator("joe@.org")); // yes or no ?
> }



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message