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?


Nice work. My preference would be RFC822. However, I do wonder how many people might get bitten by this - that are depending on the broken behavior. Sun's JavaMail has been around for quite a while. Maybe a "org.apache.geronimo.be.broken.like.sun" property to allow people that do depend on it to turn it on?

:)

geir

Rick


Reply via email to