Skip to content

Commit

Permalink
Revert "[FLINK-34954][core] Kryo Input bug fix"
Browse files Browse the repository at this point in the history
This reverts commit 3977982.
  • Loading branch information
1996fanrui committed May 22, 2024
1 parent 8b73ca9 commit 46db926
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,17 @@ protected int require(int required) throws KryoException {
position = 0;
int bytesRead = 0;
int count;
while (bytesRead < required) {
while (true) {
count = fill(buffer, bytesRead, required - bytesRead);

if (count == -1) {
throw new KryoException(new EOFException("No more bytes left."));
}

bytesRead += count;
if (bytesRead == required) {
break;
}
}
limit = required;
return required;
Expand Down Expand Up @@ -118,14 +121,18 @@ public void readBytes(byte[] bytes, int offset, int count) throws KryoException
int bytesRead = 0;
int c;

while (bytesRead < count) {
while (true) {
c = inputStream.read(bytes, offset + bytesRead, count - bytesRead);

if (c == -1) {
throw new KryoException(new EOFException("No more bytes left."));
}

bytesRead += c;

if (bytesRead == count) {
break;
}
}
} catch (IOException ex) {
throw new KryoException(ex);
Expand Down

0 comments on commit 46db926

Please sign in to comment.