RFR: 8267459: Pasting Unicode characters into JShell does not work.

Jan Lahoda jlahoda at openjdk.java.net
Thu May 20 13:22:44 UTC 2021


The NonBlockingInputStreamReader.readBuffered method will read some bytes from the InputStream, and then try to convert them to characters. But, the input array may end in the middle of a sequence - e.g. it may end with a part of UTF-8 sequence, which will be only finished when the input is read next time.

The proposed fix is to store the trailing unused bytes into the `bytes` field, which is already used for a similar purpose by the other read method in this class, and use them on the next iteration.

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

Commit messages:
 - 8267459: Pasting Unicode characters into JShell does not work.

Changes: https://git.openjdk.java.net/jdk/pull/4128/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=4128&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8267459
  Stats: 34 lines in 2 files changed: 31 ins; 0 del; 3 mod
  Patch: https://git.openjdk.java.net/jdk/pull/4128.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/4128/head:pull/4128

PR: https://git.openjdk.java.net/jdk/pull/4128


More information about the kulla-dev mailing list