Ask for review:

Alan Bateman Alan.Bateman at Sun.COM
Sat Nov 22 00:22:42 PST 2008

Xueming Shen wrote:
> Comments not necessary to the updated version.
> (1) The UnsupportedCharsetException should not be "extected" if we 
> pass in a Charset, you got one
> already:-)
Good catch! I missed this when reviewing these changes. Remi has not 
pushed these changes yet so no problem.

> (2)Is it really necessary to check "Charset.isSupproted()"? The csn 
> will be checked when the
> Charset is created later anyway, why do lookup twice. Yes, understood 
> it can catch the problem
> 1-2 step(s) earlier, I double you want to pay that price.
All parameters need to be checked before the file is created (or truncated).
> (3) The UnmappableCharacterException is tricky the current 
> StreamEncoder implementation
> always sets to use Action.REPLACE if you pass a charset (for "old 
>" OutputStreamWriter
> case) but goes whatever the "current" setting of the encoder, which 
> will be the default "report" if the
> action is NOT set to something else, so you might get uce (from all 
> nio implementation).
> OutputStreamWriter specifically "defines" the behavior when malfromed 
> or unmappable situation
> occurs (replace, if not the constructor that uses CharsetEncoder), the 
> question is what we want to
> do for this utility class, we kindly of mix  the "old" io and nio:-) 
> One alternative is to explicitly use
> CharsetEncoder for OutputStreamWriter.  If you specify the UCE, you 
> might also want to say
> something about malformed as well.
I have been meaning to talk to you about this. We need the REPORT action 
so using the CharsetEncoder form seems a good idea (thanks for thinking 
about this one).


More information about the nio-dev mailing list