james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Markus Wiederkehr" <markus.wiederk...@gmail.com>
Subject Re: [mime4j] MimeException in Field.parse()
Date Sun, 09 Nov 2008 21:50:35 GMT
On Sun, Nov 9, 2008 at 10:35 PM, Oleg Kalnichevski <olegk@apache.org> 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..


To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org

View raw message