On Sun, Nov 9, 2008 at 10:35 PM, Oleg Kalnichevski <[EMAIL PROTECTED]> wrote:
> I personally prefer a subclass of Throwable to express some kind of
> exceptional condition, but could live with InvalidField or some such.

Mime4j does not throw an exception if a date header field is
malformed. The same is true for erroneous address lists, mailboxes and
mailbox lists.

Wouldn't it be consequent not to throw an exception if a header field
does not match the required regex?

Another possible solution would be:

    public static Field parseUnchecked(final String raw) throws
IllegalArgumentException {
        // ...
    }

    public static Field parse(final String raw) throws MimeException {
        try {
            return parseUnchecked(raw);
        } catch (IllegalArgumentException e) {
            throw new MimeException("Invalid header field", e);
        }
    }

I'm not sure if I like that either..

Markus

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to