-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: @Email Validator Domain Length
PostPosted: Mon May 06, 2013 3:57 pm 
Newbie

Joined: Mon May 06, 2013 3:01 pm
Posts: 1
While attempting to validate some emails for a project I am currently working on, I took a look at the code in EmailValidator.java (v. 4.3.1-final) and realized that an email is considered invalid if the 'domain' part exceeds 63 characters, but according to the specs cited in the validator code (see below) the domain could be up to 255 characters.

Code:
private boolean matchPart(String part, Pattern pattern) {
      try {
         part = IDN.toASCII( part );
      }
      catch ( IllegalArgumentException e ) {
         // occurs when the label is too long (>63, even though it should probably be 64 - see http://www.rfc-editor.org/errata_search.php?rfc=3696,
         // practically that should not be a problem)
         return false;
      }
      Matcher matcher = pattern.matcher( part );
      return matcher.matches();
   }


Quote:
In addition to restrictions on syntax, there is a length limit on
email addresses. That limit is a maximum of 64 characters (octets)
in the "local part" (before the "@") and a maximum of 255 characters
(octets) in the domain part (after the "@") for a total length of 320
characters. However, there is a restriction in RFC 2821 on the length of an
address in MAIL and RCPT commands of 254 characters. Since addresses
that do not fit in those fields are not normally useful, the upper
limit on address lengths should normally be considered to be 254.


Is this a bug in the validator? or is this the desired behavior?


Top
 Profile  
 
 Post subject: Re: @Email Validator Domain Length
PostPosted: Wed Jun 26, 2013 9:27 am 
Hibernate Team
Hibernate Team

Joined: Sat Jan 24, 2009 12:46 pm
Posts: 388
Sorry for the late response, but this is the feedback forum for the Bean Validation specification, questions related to the implementation Hibernate Validator should be asked at https://forum.hibernate.org/viewforum.php?f=9.

That said, the behavior indeed seems not right. Could you please create a JIRA issue for this (https://hibernate.atlassian.net/browse/HV)?

Thanks,

--Gunnar

_________________
Visit my blog at http://musingsofaprogrammingaddict.blogspot.com/


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.