[jdk21u-dev] RFR: 8312475: org.jline.util.PumpReader signed byte problem

Bara' Hasheesh duke at openjdk.org
Fri Apr 11 18:24:05 UTC 2025


Clean Backport JDK-8312475: SonarCloud reports a possible issue in `read` method 

* `buffer.get()` reads a signed byte so it has a range of -128-127
* When end of file is reached the `read` method returns -1 signed integer

When the `buffer.get()` reads -1 => it returns 0xFF as a signed byte value, this causes the SonarCloud to confuse the possibility that the -1 byte value (0xFF), equals the -1 EOF value (0xFFFFFFFF)

This simply added a casting to & 0xFF to avoid this confusion.

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

Commit messages:
 - Backport bea2d48696ee2c213e475ca3aa3aa9c412b91089

Changes: https://git.openjdk.org/jdk21u-dev/pull/1552/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk21u-dev&pr=1552&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8312475
  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk21u-dev/pull/1552.diff
  Fetch: git fetch https://git.openjdk.org/jdk21u-dev.git pull/1552/head:pull/1552

PR: https://git.openjdk.org/jdk21u-dev/pull/1552


More information about the jdk-updates-dev mailing list