RFR: 8295803: Console should be usable in jshell and other environments [v7]

Jaikiran Pai jpai at openjdk.org
Tue Dec 6 06:16:09 UTC 2022


On Mon, 5 Dec 2022 19:52:59 GMT, Naoto Sato <naoto at openjdk.org> wrote:

>> This is to allow Console to be used even when it is not attached to the platform provided terminal, such as the case when the standard input is redirected. `System.console()` now returns a Console implementation based on `jdk.internal.le` terminal by default, or jshell implementation if available. A corresponding CSR has been drafted.
>
> Naoto Sato has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fixed the copyright year

src/jdk.internal.le/share/classes/jdk/internal/org/jline/JdkConsoleProviderImpl.java line 113:

> 111:         public JdkConsoleImpl() {
> 112:             try {
> 113:                 terminal = TerminalBuilder.builder().build();

The `java.io.Console` in its static initialization code has some logic to determine the `Charset` to use. Should that same `Charset` (or logic) be used here to build the terminal? Something like `TerminalBuilder.builder().encoding(fooBarCharset).build();`.

-------------

PR: https://git.openjdk.org/jdk/pull/11421


More information about the security-dev mailing list