On 26/06/2018 05:50, Joe Wang wrote:
Hi Alan, Sherman,
Here's a version where we, as Sherman suggested, throw an IAE with CCE
as the cause. This approach reduces code duplication in SC, although
it complicates the impl a little bit with the added parameter and the
different behavior between the existing usages of the methods and the
new ones. The existing code paths are kept intact so there's no
compatibility issue for the existing code.
This version also did not remove the try-catch in Files as Alan
suggested earlier.
http://cr.openjdk.java.net/~joehw/jdk11/8205058/webrev02/
This version looks much better. In StringCoding, do you really need
throwCCE? The encode/decode methods do a replace or throw so I assume
one flag will do. If combined with Sherman suggestion then it would be
minimal changes to StringCoding. It would be nice to get rid of the IAE
completely but that is for another day. In Files then you don't need to
check if cause is null before testing its type.
The update tests to check for UnmappedCharacterException and
MalformedInputException look good.
-Alan