Skip to content

Commit

Permalink
LzopInputStream : skip compressed data checksum when data is uncompre…
Browse files Browse the repository at this point in the history
…ssed.
  • Loading branch information
Raghu Angadi committed Sep 19, 2011
1 parent 3d19b14 commit c02078c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/java/com/hadoop/compression/lzo/LzopInputStream.java
Expand Up @@ -32,7 +32,6 @@
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.io.compress.BlockDecompressorStream;
import org.apache.hadoop.io.compress.Decompressor;
import org.apache.hadoop.io.IOUtils;

public class LzopInputStream extends BlockDecompressorStream {

Expand Down Expand Up @@ -220,9 +219,11 @@ private void verifyChecksums() throws IOException {
throw new IOException("Corrupted uncompressed block");
}
}
for (Map.Entry<CChecksum,Integer> chk : ccheck.entrySet()) {
if (!ldecompressor.verifyCChecksum(chk.getKey(), chk.getValue())) {
throw new IOException("Corrupted compressed block");
if (!ldecompressor.isCurrentBlockUncompressed()) {
for (Map.Entry<CChecksum,Integer> chk : ccheck.entrySet()) {
if (!ldecompressor.verifyCChecksum(chk.getKey(), chk.getValue())) {
throw new IOException("Corrupted compressed block");
}
}
}
}
Expand Down Expand Up @@ -258,7 +259,7 @@ protected int decompress(byte[] b, int off, int len) throws IOException {
return -1;
} catch (IOException e) {
LOG.warn("IOException in getCompressedData; likely LZO corruption.", e);
return -1;
throw e;
}
}
}
Expand Down

0 comments on commit c02078c

Please sign in to comment.