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

duke duke at openjdk.org
Tue Apr 15 06:46:45 UTC 2025


On Fri, 28 Mar 2025 13:46:01 GMT, Bara' Hasheesh <duke at openjdk.org> wrote:

> 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.

@Baraa-Hasheesh 
Your change (at version b3de99b03f81b6b4f664ec09102740157b97f5a1) is now ready to be sponsored by a Committer.

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

PR Comment: https://git.openjdk.org/jdk21u-dev/pull/1552#issuecomment-2803989016


More information about the jdk-updates-dev mailing list