RFR: 8331535: Incorrect prompt for Console.readLine [v3]

Jan Lahoda jlahoda at openjdk.org
Mon May 6 16:09:19 UTC 2024


> When JLine reads a line, there may be a prompt provided. However, JLine will not interpret the prompt literally, it will handle `%` specially. As a consequence, doing:
> 
> System.console().readLine("%%s");
> 
> 
> will not print `%s`, as first `String.format` is used, which will convert `%%s` to `%s`, and then JLine will interpret the `%`. The proposed solution is to duplicate the `%`, so that JLine will print it.

Jan Lahoda has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains eight commits:

 - Adjusting test as suggested.
 - Merge branch 'master' into JDK-8331535
 - 8331535: Incorrect prompt for Console.readLine
 - Fixing test.
 - Attempting to stabilize the test.
 - Improving test to really test the redirect while stdin is connected to a terminal.
 - Fixing typo.
 - 8330998: System.console() writes to stderr when stdout is redirected

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

Changes: https://git.openjdk.org/jdk/pull/19081/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19081&range=02
  Stats: 210 lines in 3 files changed: 208 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/19081.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/19081/head:pull/19081

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


More information about the core-libs-dev mailing list