For MIME4J-73 we changed the IllegalArgumentException in Field.parse() to a MimeException because loading an invalid message from an InputStream should not throw a runtime exception.
While this was correct it leads to another problem. Loading a message from an InputStream is just one scenario. The other one is creating a new message from scratch. If you know for certain that the header field to parse is well-formed the MimeException is nothing but a nuisance. So maybe what we need is a checked exception for loading a message and a runtime exception for creating a message programatically. Maybe Field.parse() should throw an IllegalArgumentException and the code that loads a message should convert it to a MimeException. But there is something else. Consider parsing a message that contains an invalid Date header field. Mime4j does _not_ throw a MimeException in this case. Instead it returns a DateTimeField instance that represents the invalid date. This DateTimeField also stores a ParseException. I think the idea behind this is that it should still be possible to parse a message even if some header fields are incorrent. In this spirit, should Field.parse() throw an exception at all? Or would it be better to return a Field instance that represents an invalid header field instead? What do you think? Markus --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
