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

Pavel Rappo prappo at openjdk.org
Thu May 9 11:15:53 UTC 2024


On Tue, 7 May 2024 07:13:23 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

>> 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 incrementally with one additional commit since the last revision:
> 
>   Adding another test run with -Djdk.console=java.base, as suggested.

Jan, if you integrate it soon, I'll improve testing in https://github.com/openjdk/jdk/pull/19112. Thanks.

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

PR Comment: https://git.openjdk.org/jdk/pull/19081#issuecomment-2102463081


More information about the core-libs-dev mailing list