Skip to content

Commit daa4d30

Browse files
committed
HADOOP-19292 Don't create new EOFException in BlockDecompressorStream
1 parent 4ff0dce commit daa4d30

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/BlockDecompressorStream.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ protected int getCompressedData() throws IOException {
126126
while (n < len) {
127127
int count = in.read(buffer, off + n, len - n);
128128
if (count < 0) {
129-
throw new EOFException("Unexpected end of block in input stream");
129+
throw EOF_EXCEPTION;
130130
}
131131
n += count;
132132
}
@@ -141,13 +141,15 @@ public void resetState() throws IOException {
141141
super.resetState();
142142
}
143143

144+
private static final EOFException EOF_EXCEPTION = new EOFException("EOF in BlockDecompressorStream");
145+
144146
private int rawReadInt() throws IOException {
145147
int b1 = in.read();
146148
int b2 = in.read();
147149
int b3 = in.read();
148150
int b4 = in.read();
149151
if ((b1 | b2 | b3 | b4) < 0)
150-
throw new EOFException();
152+
throw EOF_EXCEPTION;
151153
return ((b1 << 24) + (b2 << 16) + (b3 << 8) + (b4 << 0));
152154
}
153155
}

0 commit comments

Comments
 (0)