commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Lowe <>
Subject Re: DO NOT REPLY [Bug 32094] - [email] All exceptions seem to be thrown as messagingExceptions
Date Mon, 15 Nov 2004 08:43:29 GMT
I'm not sure what this class is for but it can be used to check char sets 


    public void setCharset(String newCharset)
        throws UnsupportedEncodingException
        if (Charset.isSupported(newCharset))
            this.charset = newCharset;
            throw new UnsupportedEncodingException("Charset unknown");

This would mean that although we'd still need to catch the UEE is
would never have any real likelyhood of getting thown.

If we chose a default charset we can also shorten the address creation
to something like

private InternetAddress createAddress(String name, String email)
        throws AddressException

        InternetAddress address = null;
new InternetAddress(email, name, this.charset);
} catch(UEE e) {
        return address;

Would be okay wouldn't it?


On Mon, 15 Nov 2004 14:17:57 +0800, Corey Scott <> wrote:
> I also like these ideas and am happy to help you implement them if you
> would like.  However there is one thing we may want to be aware of.  I
> dont think that the setCharset causes the UnsupportedCharsetException
> to be throw, I believe that it doesn't check it and therefore allows
> for any value to be set.  As we are trying to keep email small and
> maintainable, I dont think it is a good idea to try to added
> verfication to our classes.  That said, I believe that the only value
> I came accross during testing that did throw this exception was the
> setName part of the addresses.  Therefore the unsupported charset
> exception is thrown for all of the setFrom, addTo, addCc, addBcc, etc
> functions only at the moment.
> I hope this helps,
> Corey

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message