james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bernd Fondermann <bf_...@brainlounge.de>
Subject Re: svn commit: r531444 - /james/mime4j/trunk/src/main/java/org/mime4j/util/CharsetUtil.java
Date Mon, 23 Apr 2007 13:12:46 GMT
Stefano Bagnara wrote:
> Bernd Fondermann ha scritto:
>> The second "if" should not be needed anymore.
>>
>> The javadoc suggests that the charset name is not "ISO8851-1" but
>> "ISO-8851-1" (which is also required to be supported by every
>> platform)
>>
>> FWIW, J1.5 has Charset.defaultCharset() which is not applicable for 1.4.
> 
> The "new InputStreamReader(new ByteArrayInputStream(new 
> byte[0]).getEncoding()" I referred in the other reply should be the 
> workaround to get the same result.
> 
> Btw, do you think this is appropriate as the default charset to use to 
> decode messages encoded with an unknown format?
> 
> Your sentence "the second if should not be needed" made me think that an 
> empty charset should be treated as an unknown charset.
> So if on unknown charset we simply let the runtime exceptions ( 
> IllegalCharsetNameException/UnsupportedCharsetException to be raised why 
> don't we do the same on null/empty/wrong charset ?
> 
> Please note that I don't know who calls this CharsetUtil method, and how 
> they handle runtime exceptions (no time to check this now).

But that would be crucial for deciding if the method should fast-fail or 
use a proper default. It's all about the method contract. The original 
TODO comment suggests it's ok to have a default.

   Bernd


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


Mime
View raw message