diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/BlockCompressorStream.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/BlockCompressorStream.java index 434183bbc25..f2c26c190e2 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/BlockCompressorStream.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/BlockCompressorStream.java @@ -135,7 +135,7 @@ public class BlockCompressorStream extends CompressorStream { @Override public void finish() throws IOException { - if (!compressor.finished()) { + if (!compressor.finished() && compressor.getBytesRead() > 0) { rawWriteInt((int)compressor.getBytesRead()); compressor.finish(); while (!compressor.finished()) {