geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick McGuire <>
Subject Javamail address parsing (again).
Date Wed, 11 Jan 2006 13:36:17 GMT
This is starting to drive me nuts.  Writing an address parsing method 
that conforms to RFC822 is fairly easy.  Writing one that conforms to 
the javamail spec seems to be a hopeless task.  This is the complete API 
spec for the InternetAddress.parseHeader() method:

    Parse the given sequence of addresses into InternetAddress objects.
    If |strict| is false, the full syntax rules for individual addresses
    are not enforced. If |strict| is true, many (but not all) of the
    RFC822 syntax rules are enforced.

    To better support the range of "invalid" addresses seen in real
    messages, this method enforces fewer syntax rules than the |parse|
    method when the strict flag is false and enforces more rules when
    the strict flag is true. If the strict flag is false and the parse
    is successful in separating out an email address or addresses, the
    syntax of the addresses themselves is not checked.

There is absolutely no definition I can find of:

    * What syntax rules are not enforced if strict is false.
    * What syntax rules are not enforeced if strict is true.
    * What is the difference in syntax rule enforcement between
      parseHeader() and parse().  parse() seems to a rule set that lies
      between parseHeader() with strict false and parseHeader with
      strict true. 
    * What does it mean to be "successful in separating out an email
      address or addresses" without checking the syntax?  How do you
      recognize it as an email address without having syntax rules?

There don't appear to be any other sources of information available out 
there that further define this behavior.  I've been running lots of 
little test cases against the Sun version to try to figure out the 
rules, and frankly, the results have been pretty random.  The Sun 
version both allows forms that RFC822 says is invalid and rejects forms 
that RFC822 explicitly says are valid (which does not sound like a 
relaxed rule to me).  Rather tough to distinguish between bugs and 
intentional behavior.

Any suggestions on additional information sources on this or suggestions 
on how to decide which behaviors to support?


View raw message