On Thu, 21 Oct 2021 01:31:31 GMT, Sergey Bylokhov <s...@openjdk.org> wrote:
>> Naoto Sato has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Moved the null sentence into @param tag. > > src/java.base/share/classes/java/io/Console.java line 594: > >> 592: cs = Charset.forName(StaticProperty.nativeEncoding(), >> Charset.defaultCharset()); >> 593: } catch (Exception ignored) { >> 594: cs = Charset.defaultCharset(); > > What kind of actual improvements do we get here since the catch block is > still in place? In the case of Console, both charset names come from system properties and could refer to invalid or unavailable charsets. (null is handled separately). The code silently ignores the invalid values. The new method , as is, is not a fully satisfying replacement. Catching Exception is too broad a catch but may be warranted in this case so that some Console charset is selected. The new method would be useful in more cases if the default was returned for any of IllegalCharsetNameException, IllegalArgumentException, and UnsupportedCharsetException. ------------- PR: https://git.openjdk.java.net/jdk/pull/6045