Skip to content

Commit

Permalink
org.jline.util.PumpReader signed byte problem (#879)
Browse files Browse the repository at this point in the history
  • Loading branch information
turbanoff authored Oct 24, 2023
1 parent 7aa9c5e commit 405f8fe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion terminal/src/main/java/org/jline/utils/PumpReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ public int read() throws IOException {
return EOF;
}

return buffer.get();
return buffer.get() & 0xFF;
}

private boolean readUsingBuffer() throws IOException {
Expand Down
8 changes: 4 additions & 4 deletions terminal/src/test/java/org/jline/utils/PumpReaderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ public void testSplitSurrogatePair() throws IOException {
InputStream inputStream = pump.createInputStream(StandardCharsets.UTF_8);
byte[] expectedEncoded = "\uD83D\uDE0A".getBytes(StandardCharsets.UTF_8);
assertEquals(4, expectedEncoded.length); // verify that test is correctly implemented
assertEquals(expectedEncoded[0], inputStream.read());
assertEquals(expectedEncoded[1], inputStream.read());
assertEquals(expectedEncoded[2], inputStream.read());
assertEquals(expectedEncoded[3], inputStream.read());
assertEquals(expectedEncoded[0] & 0xff, inputStream.read());
assertEquals(expectedEncoded[1] & 0xff, inputStream.read());
assertEquals(expectedEncoded[2] & 0xff, inputStream.read());
assertEquals(expectedEncoded[3] & 0xff, inputStream.read());
assertEquals(-1, inputStream.read());
}

Expand Down

0 comments on commit 405f8fe

Please sign in to comment.