[jdk17u-dev] RFR: 8287003: InputStreamReader::read() can return zero despite writing a char in the buffer

Todd V. Jonker duke at openjdk.org
Fri Aug 9 20:10:15 UTC 2024


Backports a fix for a potential data-loss defect from JDK19 to JDK17.

This change is not clean, but the conflict is minimal and localized to `StreamDecoder.java`.

Viewing this diff alongside the original fix [here](https://github.com/openjdk/jdk/commit/6520843f86f638fe4d1e5b3358fab5799daca654?diff=unified&w=0#diff-e720d7662e29697b70409dd2aae7864f4e89d4bec33aa8d2ffce83cab365115eR184-R227) and expanding context upward a bit should be illuminating.  The conflict is due to structural/indentation difference when the lock acquisition at L158 was hoisted into a separate method.  That happened [here](https://github.com/openjdk/jdk/commit/9583e3657e43cc1c6f2101a64534564db2a9bd84?diff=unified&w=1#diff-e720d7662e29697b70409dd2aae7864f4e89d4bec33aa8d2ffce83cab365115eL154-L190) (wherein this file has an ugly diff obscuring relatively simple changes).

Additional testing:
- [x] New regression test fails without the fix, passes with it
- [x] linux-x86_64-server-release: `JTREG_KEYWORDS="!headful & !external-dep & !printer" make test` (tier1-3)

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

Commit messages:
 - Backport 6520843f86f638fe4d1e5b3358fab5799daca654

Changes: https://git.openjdk.org/jdk17u-dev/pull/2726/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk17u-dev&pr=2726&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8287003
  Stats: 33 lines in 2 files changed: 24 ins; 1 del; 8 mod
  Patch: https://git.openjdk.org/jdk17u-dev/pull/2726.diff
  Fetch: git fetch https://git.openjdk.org/jdk17u-dev.git pull/2726/head:pull/2726

PR: https://git.openjdk.org/jdk17u-dev/pull/2726


More information about the jdk-updates-dev mailing list