http://git-wip-us.apache.org/repos/asf/cassandra/blob/debb15ed/src/java/org/apache/cassandra/utils/MergeIterator.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/utils/MergeIterator.java b/src/java/org/apache/cassandra/utils/MergeIterator.java index 1eb8b0f..be97803 100644 --- a/src/java/org/apache/cassandra/utils/MergeIterator.java +++ b/src/java/org/apache/cassandra/utils/MergeIterator.java @@ -18,7 +18,6 @@ package org.apache.cassandra.utils; import java.io.IOException; -import java.io.IOError; import java.util.*; import com.google.common.collect.AbstractIterator; @@ -61,7 +60,7 @@ public abstract class MergeIterator<In,Out> extends AbstractIterator<Out> implem } catch (IOException e) { - throw new IOError(e); + throw new RuntimeException(e); } }
http://git-wip-us.apache.org/repos/asf/cassandra/blob/debb15ed/test/unit/org/apache/cassandra/SchemaLoader.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/SchemaLoader.java b/test/unit/org/apache/cassandra/SchemaLoader.java index eb4f3dc..8c425a4 100644 --- a/test/unit/org/apache/cassandra/SchemaLoader.java +++ b/test/unit/org/apache/cassandra/SchemaLoader.java @@ -15,7 +15,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.apache.cassandra; import java.io.File; @@ -24,8 +23,12 @@ import java.nio.ByteBuffer; import java.util.*; import java.util.concurrent.atomic.AtomicInteger; - import com.google.common.base.Charsets; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import org.apache.cassandra.config.*; import org.apache.cassandra.db.*; import org.apache.cassandra.db.commitlog.CommitLog; @@ -42,11 +45,6 @@ import org.apache.cassandra.service.MigrationManager; import org.apache.cassandra.thrift.IndexType; import org.apache.cassandra.utils.ByteBufferUtil; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - public class SchemaLoader { private static Logger logger = LoggerFactory.getLogger(SchemaLoader.class); @@ -348,7 +346,7 @@ public class SchemaLoader return cfmd; } - public static void cleanupAndLeaveDirs() throws IOException + public static void cleanupAndLeaveDirs() { mkdirs(); cleanup(); @@ -356,7 +354,7 @@ public class SchemaLoader CommitLog.instance.resetUnsafe(); // cleanup screws w/ CommitLog, this brings it back to safe state } - public static void cleanup() throws IOException + public static void cleanup() { // clean up commitlog String[] directoryNames = { DatabaseDescriptor.getCommitLogLocation(), }; @@ -382,14 +380,7 @@ public class SchemaLoader public static void mkdirs() { - try - { - DatabaseDescriptor.createAllDirectories(); - } - catch (IOException e) - { - throw new RuntimeException(e); - } + DatabaseDescriptor.createAllDirectories(); } protected void insertData(String keyspace, String columnFamily, int offset, int numberOfRows) throws IOException http://git-wip-us.apache.org/repos/asf/cassandra/blob/debb15ed/test/unit/org/apache/cassandra/Util.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/Util.java b/test/unit/org/apache/cassandra/Util.java index d783413..336755c 100644 --- a/test/unit/org/apache/cassandra/Util.java +++ b/test/unit/org/apache/cassandra/Util.java @@ -250,7 +250,7 @@ public class Util return CompactionManager.instance.submitUserDefined(cfs, descriptors, Integer.MAX_VALUE); } - public static void compact(ColumnFamilyStore cfs, Collection<SSTableReader> sstables, boolean forceDeserialize) throws IOException + public static void compact(ColumnFamilyStore cfs, Collection<SSTableReader> sstables, boolean forceDeserialize) { CompactionTask task = new CompactionTask(cfs, sstables, (int) (System.currentTimeMillis() / 1000) - cfs.metadata.getGcGraceSeconds()); task.isUserDefined(forceDeserialize); @@ -270,7 +270,7 @@ public class Util { callable.call(); } - catch (Exception e) + catch (Throwable e) { assert e.getClass().equals(exception) : e.getClass().getName() + " is not " + exception.getName(); thrown = true; http://git-wip-us.apache.org/repos/asf/cassandra/blob/debb15ed/test/unit/org/apache/cassandra/db/DirectoriesTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/DirectoriesTest.java b/test/unit/org/apache/cassandra/db/DirectoriesTest.java index d3683d2..d1a44fd 100644 --- a/test/unit/org/apache/cassandra/db/DirectoriesTest.java +++ b/test/unit/org/apache/cassandra/db/DirectoriesTest.java @@ -51,7 +51,7 @@ public class DirectoriesTest } @AfterClass - public static void afterClass() throws IOException + public static void afterClass() { Directories.resetDataDirectoriesAfterTest(); FileUtils.deleteRecursive(tempDataDir); http://git-wip-us.apache.org/repos/asf/cassandra/blob/debb15ed/test/unit/org/apache/cassandra/db/SecondaryIndexColumnSizeTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/db/SecondaryIndexColumnSizeTest.java b/test/unit/org/apache/cassandra/db/SecondaryIndexColumnSizeTest.java index 9b5f070..cc52f3c 100644 --- a/test/unit/org/apache/cassandra/db/SecondaryIndexColumnSizeTest.java +++ b/test/unit/org/apache/cassandra/db/SecondaryIndexColumnSizeTest.java @@ -75,7 +75,7 @@ public class SecondaryIndexColumnSizeTest private class MockRowIndex extends PerRowSecondaryIndex { @Override - public void applyIndexUpdates(ByteBuffer rowKey, ColumnFamily cf, SortedSet<ByteBuffer> mutatedIndexedColumns, ColumnFamily oldIndexedColumns) throws IOException + public void applyIndexUpdates(ByteBuffer rowKey, ColumnFamily cf, SortedSet<ByteBuffer> mutatedIndexedColumns, ColumnFamily oldIndexedColumns) { } @@ -102,7 +102,7 @@ public class SecondaryIndexColumnSizeTest } @Override - public void forceBlockingFlush() throws IOException + public void forceBlockingFlush() { } @@ -119,7 +119,7 @@ public class SecondaryIndexColumnSizeTest } @Override - public void removeIndex(ByteBuffer columnName) throws IOException + public void removeIndex(ByteBuffer columnName) { } @@ -166,7 +166,7 @@ public class SecondaryIndexColumnSizeTest } @Override - public void forceBlockingFlush() throws IOException + public void forceBlockingFlush() { } @@ -183,7 +183,7 @@ public class SecondaryIndexColumnSizeTest } @Override - public void removeIndex(ByteBuffer columnName) throws IOException + public void removeIndex(ByteBuffer columnName) { } @@ -198,17 +198,17 @@ public class SecondaryIndexColumnSizeTest } @Override - public void deleteColumn(DecoratedKey valueKey, ByteBuffer rowKey, IColumn col) throws IOException + public void deleteColumn(DecoratedKey valueKey, ByteBuffer rowKey, IColumn col) { } @Override - public void insertColumn(DecoratedKey valueKey, ByteBuffer rowKey, IColumn col) throws IOException + public void insertColumn(DecoratedKey valueKey, ByteBuffer rowKey, IColumn col) { } @Override - public void updateColumn(DecoratedKey valueKey, ByteBuffer rowKey, IColumn col) throws IOException + public void updateColumn(DecoratedKey valueKey, ByteBuffer rowKey, IColumn col) { } } http://git-wip-us.apache.org/repos/asf/cassandra/blob/debb15ed/test/unit/org/apache/cassandra/io/compress/CompressedRandomAccessReaderTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/io/compress/CompressedRandomAccessReaderTest.java b/test/unit/org/apache/cassandra/io/compress/CompressedRandomAccessReaderTest.java index 86216d1..eabb489 100644 --- a/test/unit/org/apache/cassandra/io/compress/CompressedRandomAccessReaderTest.java +++ b/test/unit/org/apache/cassandra/io/compress/CompressedRandomAccessReaderTest.java @@ -20,16 +20,15 @@ package org.apache.cassandra.io.compress; import java.io.*; import java.util.Random; -import java.util.concurrent.Callable; import org.junit.Test; +import org.apache.cassandra.io.sstable.CorruptSSTableException; import org.apache.cassandra.io.sstable.SSTableMetadata; import org.apache.cassandra.io.util.*; import static org.junit.Assert.assertEquals; - -import static org.apache.cassandra.Util.expectException; +import static org.junit.Assert.assertNotNull; public class CompressedRandomAccessReaderTest { @@ -145,13 +144,18 @@ public class CompressedRandomAccessReaderTest final RandomAccessReader r = CompressedRandomAccessReader.open(file.getPath(), meta, false); - expectException(new Callable<String>() + Throwable exception = null; + try + { + r.readLine(); + } + catch (Throwable t) { - public String call() throws Exception - { - return r.readLine(); - } - }, CorruptedBlockException.class); + exception = t; + } + assertNotNull(exception); + assertEquals(exception.getClass(), CorruptSSTableException.class); + assertEquals(exception.getCause().getClass(), CorruptBlockException.class); r.close(); } http://git-wip-us.apache.org/repos/asf/cassandra/blob/debb15ed/test/unit/org/apache/cassandra/io/util/BufferedRandomAccessFileTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/io/util/BufferedRandomAccessFileTest.java b/test/unit/org/apache/cassandra/io/util/BufferedRandomAccessFileTest.java index 9eba5be..e38850d 100644 --- a/test/unit/org/apache/cassandra/io/util/BufferedRandomAccessFileTest.java +++ b/test/unit/org/apache/cassandra/io/util/BufferedRandomAccessFileTest.java @@ -241,14 +241,14 @@ public class BufferedRandomAccessFileTest assertEquals(file.bytesRemaining(), file.length() - 20); // trying to seek past the end of the file should produce EOFException - expectEOF(new Callable<Object>() + expectException(new Callable<Object>() { - public Object call() throws Exception + public Object call() { file.seek(file.length() + 30); return null; } - }); + }, IllegalArgumentException.class); expectException(new Callable<Object>() { @@ -433,11 +433,11 @@ public class BufferedRandomAccessFileTest expectException(new Callable<Object>() { - public Object call() throws IOException + public Object call() { return r.read(); } - }, ClosedChannelException.class); + }, AssertionError.class); expectException(new Callable<Object>() { @@ -524,14 +524,14 @@ public class BufferedRandomAccessFileTest assertTrue(copy.bytesRemaining() == 0 && copy.isEOF()); // can't seek past the end of the file for read-only files - expectEOF(new Callable<Object>() + expectException(new Callable<Object>() { - public Object call() throws IOException + public Object call() { copy.seek(copy.length() + 1); return null; } - }); + }, IllegalArgumentException.class); // Any write() call should fail expectException(new Callable<Object>() http://git-wip-us.apache.org/repos/asf/cassandra/blob/debb15ed/test/unit/org/apache/cassandra/streaming/SerializationsTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/streaming/SerializationsTest.java b/test/unit/org/apache/cassandra/streaming/SerializationsTest.java index c904881..13493f9 100644 --- a/test/unit/org/apache/cassandra/streaming/SerializationsTest.java +++ b/test/unit/org/apache/cassandra/streaming/SerializationsTest.java @@ -205,14 +205,7 @@ public class SerializationsTest extends AbstractSerializationsTester { RowMutation rm = new RowMutation(t.name, ByteBufferUtil.bytes(Long.toString(System.nanoTime()))); rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes("cola")), ByteBufferUtil.bytes("value"), 0); - try - { - rm.apply(); - } - catch (IOException ex) - { - throw new RuntimeException(ex); - } + rm.apply(); } try {