Skip to content

Commit 64ff30f

Browse files
committed
add check compressor's byte size when finish compress
1 parent d0b2c58 commit 64ff30f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public void write(byte[] b, int off, int len) throws IOException {
135135

136136
@Override
137137
public void finish() throws IOException {
138-
if (!compressor.finished()) {
138+
if (!compressor.finished() && compressor.getBytesRead() > 0) {
139139
rawWriteInt((int)compressor.getBytesRead());
140140
compressor.finish();
141141
while (!compressor.finished()) {

0 commit comments

Comments
 (0)