Save source exception in CorruptBlockException ninja patch by Pavel Yaskevich; ninja reviewed by Aleksey Yeschenko
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/a5617d68 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/a5617d68 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/a5617d68 Branch: refs/heads/cassandra-2.1 Commit: a5617d689c8feee40f9412c373d02c9f1770d359 Parents: e28e7bf Author: Pavel Yaskevich <xe...@apache.org> Authored: Fri Aug 22 21:52:11 2014 +0300 Committer: Aleksey Yeschenko <alek...@apache.org> Committed: Fri Aug 22 21:52:11 2014 +0300 ---------------------------------------------------------------------- .../io/compress/CompressedRandomAccessReader.java | 2 +- .../cassandra/io/compress/CorruptBlockException.java | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/a5617d68/src/java/org/apache/cassandra/io/compress/CompressedRandomAccessReader.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/io/compress/CompressedRandomAccessReader.java b/src/java/org/apache/cassandra/io/compress/CompressedRandomAccessReader.java index 131a4d6..64495b8 100644 --- a/src/java/org/apache/cassandra/io/compress/CompressedRandomAccessReader.java +++ b/src/java/org/apache/cassandra/io/compress/CompressedRandomAccessReader.java @@ -119,7 +119,7 @@ public class CompressedRandomAccessReader extends RandomAccessReader } catch (IOException e) { - throw new CorruptBlockException(getPath(), chunk); + throw new CorruptBlockException(getPath(), chunk, e); } if (metadata.parameters.getCrcCheckChance() > FBUtilities.threadLocalRandom().nextDouble()) http://git-wip-us.apache.org/repos/asf/cassandra/blob/a5617d68/src/java/org/apache/cassandra/io/compress/CorruptBlockException.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/io/compress/CorruptBlockException.java b/src/java/org/apache/cassandra/io/compress/CorruptBlockException.java index 60b4d1f..bcce6b9 100644 --- a/src/java/org/apache/cassandra/io/compress/CorruptBlockException.java +++ b/src/java/org/apache/cassandra/io/compress/CorruptBlockException.java @@ -23,11 +23,21 @@ public class CorruptBlockException extends IOException { public CorruptBlockException(String filePath, CompressionMetadata.Chunk chunk) { - this(filePath, chunk.offset, chunk.length); + this(filePath, chunk, null); + } + + public CorruptBlockException(String filePath, CompressionMetadata.Chunk chunk, Throwable cause) + { + this(filePath, chunk.offset, chunk.length, cause); } public CorruptBlockException(String filePath, long offset, int length) { - super(String.format("(%s): corruption detected, chunk at %d of length %d.", filePath, offset, length)); + this(filePath, offset, length, null); + } + + public CorruptBlockException(String filePath, long offset, int length, Throwable cause) + { + super(String.format("(%s): corruption detected, chunk at %d of length %d.", filePath, offset, length), cause); } }