commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From S├ębastien De Nef <sebastien.de...@gmail.com>
Subject [validator] EmailValidator accept empty domain names
Date Thu, 22 Oct 2015 07:05:14 GMT
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 ?
}

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message