RFR: 8358552: EndOfFileException in System.in.read() and IO.readln() etc. in JShell
Christian Stein
cstein at openjdk.org
Mon Jun 30 07:31:52 UTC 2025
On Tue, 10 Jun 2025 08:29:15 GMT, Christian Stein <cstein at openjdk.org> wrote:
> Please review this change to handle an `EndOfFileException` while reading input from a user console in such a way, that no stacktrace is emitted. The handling of the `Ctrl+D` command is left as-is; here the following underlying core-libs should stay in control:
>
> - `System.in.read()`
> - `System.console().reader().read()`
> - `System.console().readLine()`
> - `System.console().readPassword()`
> - `System.in.readAllBytes()`
> - `IO.readln()`
test/langtools/jdk/jshell/InputUITest.java line 78:
> 76: "System.console().readPassword()", " ==> null",
> 77: "IO.readln()", " ==> \"null\""
> 78: // TODO , "System.in.readAllBytes()", " ==> " // ... hangs forever
Manual testing in a JShell session with this change set applied shows the watend behaviour: breaks with Ctrl+C and no exception is printed for Ctrl+D
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25713#discussion_r2174399555
More information about the kulla-dev
mailing list