RFR: 8357995: Use "stdin.encoding" for reading System.in with InputStreamReader/Scanner [core] [v5]
Volkan Yazici
vyazici at openjdk.org
Wed Jun 11 10:37:30 UTC 2025
On Thu, 5 Jun 2025 10:13:24 GMT, Volkan Yazici <vyazici at openjdk.org> wrote:
>> Passes the `Charset` read from the `stdin.encoding` system property while creating `InputStreamReader` or `Scanner` instances for `System.in`.
>>
>> `stdin.encoding` is a recently added property for Java 25 in [JDK-8350703](https://bugs.openjdk.org/browse/JDK-8350703). Employing it throughout the entire code base is addressed by the parent ticket [JDK-8356893](https://bugs.openjdk.org/browse/JDK-8356893). JDK-8357995 this PR is addressing is a sub-task of JDK-8356893 and is concerned with only areas related to core libraries.
>
> Volkan Yazici has updated the pull request incrementally with one additional commit since the last revision:
>
> Improve code style
>
> Co-authored-by: Andrey Turbanov <turbanoff at gmail.com>
test/jdk/javax/security/auth/login/LoginContext/DefaultHandlerImpl.java line 80:
> 78: System.err.flush();
> 79: Reader stdinReader = new InputStreamReader(System.in, System.getProperty("stdin.encoding"));
> 80: nc.setName(new BufferedReader(stdinReader).readLine());
Will revert this change, it is superfluous. As a matter of fact, there is a `readPassword(System.in)` down below that could have also been addressed.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25544#discussion_r2139795483
More information about the nio-dev
mailing list