I'd prefer RFC822 compliance. I have no way to judge whether a compatibility mode for sun's implementation would be needed but would prefer not to complicate our code with it if at all possible.

thanks
david jencks

On Jan 4, 2006, at 4:07 AM, Rick McGuire wrote:

I'm trying to write a fuller implementation of the InternetAddress.parseHeader() method for the Geronimo javamail implementation. I've been writing some tests to see how the Sun javamail implementation is handling various addresses, and then rolling these tests into the Geronimo junit tests for InternetAddress. While doing this, I ran the existing junit tests against the Sun javamail package and discovered that the Sun version failed some of the Geronimo unit tests! Specifically, any of the group address tests in InternetAddressTest where the group did not contain a leading phrase did not get recognized as a group address. Thus the tests for ":[EMAIL PROTECTED];" and ":[EMAIL PROTECTED], [EMAIL PROTECTED];" failed when run against the Sun javamail version.

It would be fairly simple to fix the Geronimo version to match the Sun results and fix the tests as well, but I'm not convinced that either version is handling this correctly. RFC822 specifies that the tag phrase before the ":" in an address is required. So ":[EMAIL PROTECTED];" is not a valid group, but "group:[EMAIL PROTECTED]'" is. The Geronimo versions appears to be incorrect, both in the implementation and the unit test. However, according the Sun version is parsing ":[EMAIL PROTECTED];" as being a simple internet address, retaining both the ":" and ";" as part of the address. Strict conformance to RFC822 would consider this to be an error rather than a simple address, and I don't believe most mail servers would accept that syntax. So, what should I target here? Compatibility with the Sun version, or conformance to the RFC822 specification?

Rick

Reply via email to