On Fri, 22 Oct 2021 17:33:43 GMT, Naoto Sato <na...@openjdk.org> wrote:
>> During the review of JEP 400, a proposal to provide an overloaded method to >> `Charset.forName()` was suggested >> [[1]](https://github.com/openjdk/jdk/pull/4733#discussion_r669693954). This >> PR is to implement the proposal. A CSR is also drafted as >> https://bugs.openjdk.java.net/browse/JDK-8275348 > > Naoto Sato has updated the pull request incrementally with one additional > commit since the last revision: > > Removed `@throws IllegalCharsetNameException` Just an idea, should we check that the second parameter is null or not? Any pros and cons of that? For example should this code be allowed: var cs = Charset.forName(charsetName, null); if (cs == null) { System.err.println("Used UTF-8 encoding instead of "+charsetName+"); cs = StandardCharsets.UTF_8; } Or something like this should be forced: var cs = Charset.forName(charsetName, fallback); if (cs == fallback) { System.err.println("Used UTF-8 encoding instead of "+charsetName+"); } I have no preference. ------------- PR: https://git.openjdk.java.net/jdk/pull/6045