Skip to content

Commit

Permalink
HADOOP-19292 Don't create new EOFException in BlockDecompressorStream
Browse files Browse the repository at this point in the history
  • Loading branch information
tsuna committed Oct 1, 2024
1 parent 4ff0dce commit daa4d30
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ protected int getCompressedData() throws IOException {
while (n < len) {
int count = in.read(buffer, off + n, len - n);
if (count < 0) {
throw new EOFException("Unexpected end of block in input stream");
throw EOF_EXCEPTION;
}
n += count;
}
Expand All @@ -141,13 +141,15 @@ public void resetState() throws IOException {
super.resetState();
}

private static final EOFException EOF_EXCEPTION = new EOFException("EOF in BlockDecompressorStream");

private int rawReadInt() throws IOException {
int b1 = in.read();
int b2 = in.read();
int b3 = in.read();
int b4 = in.read();
if ((b1 | b2 | b3 | b4) < 0)
throw new EOFException();
throw EOF_EXCEPTION;
return ((b1 << 24) + (b2 << 16) + (b3 << 8) + (b4 << 0));
}
}

0 comments on commit daa4d30

Please sign in to comment.