From 9c8fea836722c7dc5b7deb73b5bca66867cbf2f6 Mon Sep 17 00:00:00 2001 From: Peter Lawrey Date: Sun, 28 Jun 2015 18:52:05 +0100 Subject: [PATCH] Replace "throws Exception" with the specific Exception(s) thrown. --- .../internal/DataValueBytesMarshallers.java | 4 +-- .../map/EngineReplicationLangBytes.java | 2 +- .../chronicle/map/ReplicatedChronicleMap.java | 4 +-- .../chronicle/map/StatelessChronicleMap.java | 2 +- .../chronicle/map/VanillaChronicleMap.java | 15 +++++----- .../chronicle/map/AcquireGetUsingMain.java | 3 +- .../openhft/chronicle/map/BitUnitTest.java | 6 ++-- .../net/openhft/chronicle/map/CHMTest5.java | 3 +- .../chronicle/map/CHMTestIterator1.java | 2 +- .../chronicle/map/ChronicleMapTest.java | 28 +++++++++---------- .../chronicle/map/ConcurrentMap8Test.java | 2 +- .../chronicle/map/DemoChronicleMapTest.java | 5 ++-- .../chronicle/map/EntryCountMapTest.java | 13 ++++----- .../chronicle/map/IntIntMultiMapTest.java | 3 +- .../map/ProcessInstanceLimiterMain.java | 2 +- .../map/ReplicatedChronicleMapTest.java | 2 +- .../openhft/chronicle/map/SerializerTest.java | 10 +++---- ...ReplicationWithAcquireUsingLockedTest.java | 6 ++-- .../chronicle/map/TestReplication.java | 3 +- .../map/ipc/StateMachineTutorial.java | 2 +- .../chronicle/map/jsr166/JSR166TestCase.java | 5 ++-- .../map/jsr166/map/ChronicleMapTest.java | 2 +- .../chronicle/map/jsr166/map/MapCheck.java | 4 +-- .../map/utility/ProcessInstanceLimiter.java | 2 +- .../set/ChronicleSetBuilderTest.java | 2 +- 25 files changed, 67 insertions(+), 65 deletions(-) diff --git a/src/main/java/net/openhft/chronicle/hash/serialization/internal/DataValueBytesMarshallers.java b/src/main/java/net/openhft/chronicle/hash/serialization/internal/DataValueBytesMarshallers.java index eda8910a9..f14650b71 100644 --- a/src/main/java/net/openhft/chronicle/hash/serialization/internal/DataValueBytesMarshallers.java +++ b/src/main/java/net/openhft/chronicle/hash/serialization/internal/DataValueBytesMarshallers.java @@ -180,7 +180,7 @@ public final class DataValueBytesMarshallers { " }\n" + "\n" + " @Override\n" + - " " + simpleName + " getInstance() throws Exception {\n" + + " " + simpleName + " getInstance() {\n" + " return factory.create();\n" + " }\n" + "}\n"; @@ -531,7 +531,7 @@ public final class DataValueBytesMarshallers { private static void generateGetInstance(StringBuilder sb, Class cl) { sb.append(" ").append(cl.getCanonicalName()) - .append(" getInstance() throws Exception {\n"); + .append(" getInstance() {\n"); sb.append(" ").append("return new ").append(cl.getName()).append("$$Native();\n"); sb.append(" ").append("}\n\n"); } diff --git a/src/main/java/net/openhft/chronicle/map/EngineReplicationLangBytes.java b/src/main/java/net/openhft/chronicle/map/EngineReplicationLangBytes.java index aec288de5..d1636f9b5 100644 --- a/src/main/java/net/openhft/chronicle/map/EngineReplicationLangBytes.java +++ b/src/main/java/net/openhft/chronicle/map/EngineReplicationLangBytes.java @@ -133,7 +133,7 @@ public interface EngineReplicationLangBytes extends Closeable { * @return {@code true} if the entry was accepted by the {@code callback.onEntry()} method, * {@code false} if the entry was not accepted or was not available */ - boolean nextEntry(@NotNull final EngineEntryCallback callback) throws InterruptedException; + boolean nextEntry(@NotNull final EngineEntryCallback callback); /** * Dirties all entries with a modification time equal to {@code fromTimeStamp} or newer. It diff --git a/src/main/java/net/openhft/chronicle/map/ReplicatedChronicleMap.java b/src/main/java/net/openhft/chronicle/map/ReplicatedChronicleMap.java index 8de63569f..a8cbaad59 100644 --- a/src/main/java/net/openhft/chronicle/map/ReplicatedChronicleMap.java +++ b/src/main/java/net/openhft/chronicle/map/ReplicatedChronicleMap.java @@ -455,7 +455,7 @@ final class ReplicatedChronicleMap implements ChronicleMap, Closeable, Clon } } - private void resizeToMessageOutBuffer(long start, @NotNull Exception e) throws Exception { + private void resizeToMessageOutBuffer(long start, @NotNull T e) throws T { assert outBytesLock.isHeldByCurrentThread(); assert !inBytesLock.isHeldByCurrentThread(); String message = e.getMessage(); diff --git a/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java b/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java index bfd84aae7..eced71de7 100755 --- a/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java +++ b/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java @@ -1822,12 +1822,16 @@ class VanillaChronicleMap, @Override public final ReadLocked readLock( - @Nullable SegmentState segmentState) throws InterruptedException { + @Nullable SegmentState segmentState) { while (true) { // final boolean success = segmentHeader.tryRWReadLock(LOCK_OFFSET, lockTimeOutNS); - final boolean success; + boolean success = false; - success = segmentHeader.tryRWWriteLock(LOCK_OFFSET, lockTimeOutNS); + try { + success = segmentHeader.tryRWWriteLock(LOCK_OFFSET, lockTimeOutNS); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } /* boolean success = false; @@ -2825,11 +2829,8 @@ class VanillaChronicleMap, final Segment segment = segments[segIndex]; ThreadLocalCopies copies = SegmentState.getCopies(null); try (SegmentState segmentState = SegmentState.get(copies)) { - try { segment.readLock(null); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } + if (segment.hashLookup().getPositions().isClear(pos)) { // the pos was removed after the previous advance advance(segIndex, pos); diff --git a/src/test/java/net/openhft/chronicle/map/AcquireGetUsingMain.java b/src/test/java/net/openhft/chronicle/map/AcquireGetUsingMain.java index cfb790e5f..08f5e38c5 100644 --- a/src/test/java/net/openhft/chronicle/map/AcquireGetUsingMain.java +++ b/src/test/java/net/openhft/chronicle/map/AcquireGetUsingMain.java @@ -21,11 +21,12 @@ import net.openhft.lang.model.DataValueClasses; import net.openhft.lang.model.constraints.MaxSize; import java.io.File; +import java.io.IOException; import static org.junit.Assert.fail; public class AcquireGetUsingMain { - public static void main(String[] args) throws Exception { + public static void main(String[] args) throws IOException { File file = new File(System.getProperty("java.io.tmpdir") + "/test1"); ChronicleMap theSharedMap = ChronicleMapBuilder.of(String.class, Data.class) diff --git a/src/test/java/net/openhft/chronicle/map/BitUnitTest.java b/src/test/java/net/openhft/chronicle/map/BitUnitTest.java index 67ce5240f..9370d4675 100644 --- a/src/test/java/net/openhft/chronicle/map/BitUnitTest.java +++ b/src/test/java/net/openhft/chronicle/map/BitUnitTest.java @@ -20,12 +20,12 @@ import junit.framework.TestCase; public class BitUnitTest extends TestCase { - public void testToBits() throws Exception { + public void testToBits() { } - public void testToMegaBits() throws Exception { + public void testToMegaBits() { } - public void testToGigaBits() throws Exception { + public void testToGigaBits() { } } \ No newline at end of file diff --git a/src/test/java/net/openhft/chronicle/map/CHMTest5.java b/src/test/java/net/openhft/chronicle/map/CHMTest5.java index 1478e092e..abdc80540 100644 --- a/src/test/java/net/openhft/chronicle/map/CHMTest5.java +++ b/src/test/java/net/openhft/chronicle/map/CHMTest5.java @@ -20,6 +20,7 @@ import net.openhft.lang.model.DataValueClasses; import net.openhft.lang.model.constraints.MaxSize; import java.io.File; +import java.io.IOException; import static org.junit.Assert.assertEquals; @@ -30,7 +31,7 @@ public class CHMTest5 { public static final String TEST_KEY = "whatever"; public static int NUMBER_OF_PROCESSES_ALLOWED = 2; - public static void main(String[] args) throws Exception { + public static void main(String[] args) throws IOException { //First create (or access if already created) the shared map ChronicleMapBuilder builder = ChronicleMapBuilder.of(String.class, CHMTest5Data.class) diff --git a/src/test/java/net/openhft/chronicle/map/CHMTestIterator1.java b/src/test/java/net/openhft/chronicle/map/CHMTestIterator1.java index 2aae1bf8c..783b40e25 100644 --- a/src/test/java/net/openhft/chronicle/map/CHMTestIterator1.java +++ b/src/test/java/net/openhft/chronicle/map/CHMTestIterator1.java @@ -24,7 +24,7 @@ import java.util.concurrent.atomic.AtomicLong; */ public class CHMTestIterator1 { - public static void main(String[] args) throws Exception { + public static void main(String[] args) { AtomicLong alValue = new AtomicLong(); AtomicLong alKey = new AtomicLong(); int runs = 3000000; diff --git a/src/test/java/net/openhft/chronicle/map/ChronicleMapTest.java b/src/test/java/net/openhft/chronicle/map/ChronicleMapTest.java index cdf463d60..f083720f7 100755 --- a/src/test/java/net/openhft/chronicle/map/ChronicleMapTest.java +++ b/src/test/java/net/openhft/chronicle/map/ChronicleMapTest.java @@ -139,7 +139,7 @@ public class ChronicleMapTest { } @Test - public void testRemoveWithKey() throws Exception { + public void testRemoveWithKey() { try (final ChronicleMap map = ChronicleMapBuilder @@ -186,7 +186,7 @@ public class ChronicleMapTest { @Test - public void testByteArrayPersistenceFileReuse() throws Exception { + public void testByteArrayPersistenceFileReuse() throws IOException { final File persistenceFile = Builder.getPersistenceFile(); for (int i = 0; i < 2; i++) { @@ -205,7 +205,7 @@ public class ChronicleMapTest { } @Test - public void testEqualsCharSequence() throws Exception { + public void testEqualsCharSequence() { ChronicleMapBuilder builder = ChronicleMapBuilder.of(CharSequence.class, CharSequence.class); @@ -224,7 +224,7 @@ public class ChronicleMapTest { @Ignore("HCOLL-265 Chronicle Maps with Identical byte[] & char[] values are not equal") @Test - public void testEqualsCharArray() throws Exception { + public void testEqualsCharArray() { char[] value = new char[5]; Arrays.fill(value, 'X'); @@ -247,7 +247,7 @@ public class ChronicleMapTest { @Ignore("HCOLL-265 Chronicle Maps with Identical byte[] & char[] values are not equal") @Test - public void testEqualsByteArray() throws Exception { + public void testEqualsByteArray() { byte[] value = new byte[5]; Arrays.fill(value, (byte) 'X'); @@ -269,7 +269,7 @@ public class ChronicleMapTest { @Test - public void testSize() throws Exception { + public void testSize() { try (final ChronicleMap map = ChronicleMapBuilder.of(CharSequence.class, CharSequence.class) @@ -315,7 +315,7 @@ public class ChronicleMapTest { } @Test - public void testRemoveWithKeyAndRemoveReturnsNull() throws Exception { + public void testRemoveWithKeyAndRemoveReturnsNull() { try (final ChronicleMap map = ChronicleMapBuilder.of(CharSequence.class, CharSequence.class) @@ -361,7 +361,7 @@ public class ChronicleMapTest { } @Test - public void testReplaceWithKey() throws Exception { + public void testReplaceWithKey() { try (final ChronicleMap map = ChronicleMapBuilder.of(CharSequence.class, CharSequence.class) @@ -425,7 +425,7 @@ public class ChronicleMapTest { } @Test - public void testReplaceWithKeyAnd2Params() throws Exception { + public void testReplaceWithKeyAnd2Params() { try (final ChronicleMap map = ChronicleMapBuilder.of(CharSequence.class, CharSequence.class) @@ -467,7 +467,7 @@ public class ChronicleMapTest { } @Test - public void testRemoveWithKeyAndValue() throws Exception { + public void testRemoveWithKeyAndValue() { try (final ChronicleMap map = ChronicleMapBuilder.of(CharSequence.class, CharSequence.class) @@ -504,7 +504,7 @@ public class ChronicleMapTest { } @Test - public void testAcquireWithNullContainer() throws Exception { + public void testAcquireWithNullContainer() { try (ChronicleMap map = ChronicleMapBuilder.of(CharSequence.class, LongValue.class) .entries(1000) @@ -547,7 +547,7 @@ public class ChronicleMapTest { // 1000M users, updated 16 times, Throughput 1.3 M ops/sec, TODO FIX this @Test - public void testGetWithNullContainer() throws Exception { + public void testGetWithNullContainer() { try (ChronicleMap map = ChronicleMapBuilder.of(CharSequence.class, LongValue.class) .entries(10) @@ -560,7 +560,7 @@ public class ChronicleMapTest { } @Test - public void testGetWithoutAcquireFirst() throws Exception { + public void testGetWithoutAcquireFirst() { try (ChronicleMap map = ChronicleMapBuilder.of(CharSequence.class, LongValue.class) .entries(10) @@ -696,7 +696,7 @@ public class ChronicleMapTest { @Ignore("Possible candidate for TC JVM crashes") @Test - public void testAcquireFromMultipleThreads() throws Exception { + public void testAcquireFromMultipleThreads() throws InterruptedException { int entries = 1000 * 1000; try (ChronicleMap map2 = ChronicleMapBuilder.of(CharSequence.class, LongValue.class) diff --git a/src/test/java/net/openhft/chronicle/map/ConcurrentMap8Test.java b/src/test/java/net/openhft/chronicle/map/ConcurrentMap8Test.java index c72eb89d4..7713c3bd1 100644 --- a/src/test/java/net/openhft/chronicle/map/ConcurrentMap8Test.java +++ b/src/test/java/net/openhft/chronicle/map/ConcurrentMap8Test.java @@ -589,7 +589,7 @@ public class ConcurrentMap8Test extends JSR166TestCase { * A deserialized serialized set is equal *//* @Test - public void testSerialization() throws Exception { + public void testSerialization() { int size = 20; Set x = populatedSet(size); Set y = serialClone(x); diff --git a/src/test/java/net/openhft/chronicle/map/DemoChronicleMapTest.java b/src/test/java/net/openhft/chronicle/map/DemoChronicleMapTest.java index 51eccb99c..c974203a3 100755 --- a/src/test/java/net/openhft/chronicle/map/DemoChronicleMapTest.java +++ b/src/test/java/net/openhft/chronicle/map/DemoChronicleMapTest.java @@ -22,6 +22,7 @@ import net.openhft.lang.values.IntValue; import org.junit.Test; import java.io.File; +import java.io.IOException; import java.util.Map; import static org.junit.Assert.*; @@ -29,7 +30,7 @@ import static org.junit.Assert.*; public class DemoChronicleMapTest { @Test - public void testMap() throws Exception { + public void testMap() throws IOException { File file = File.createTempFile("DummyOrders"+System.currentTimeMillis(), ".test"); file.deleteOnExit(); int maxEntries = 1000; @@ -71,7 +72,7 @@ public class DemoChronicleMapTest { } @Test - public void testMapLocked() throws Exception { + public void testMapLocked() throws IOException { File file = File.createTempFile("DummyOrders-"+System.currentTimeMillis(), ".test"); file.deleteOnExit(); int maxEntries = 1000; diff --git a/src/test/java/net/openhft/chronicle/map/EntryCountMapTest.java b/src/test/java/net/openhft/chronicle/map/EntryCountMapTest.java index 7171ec7b2..4209a0211 100644 --- a/src/test/java/net/openhft/chronicle/map/EntryCountMapTest.java +++ b/src/test/java/net/openhft/chronicle/map/EntryCountMapTest.java @@ -26,10 +26,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Random; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; +import java.util.concurrent.*; import static java.lang.Math.log10; import static java.lang.Math.round; @@ -62,7 +59,7 @@ public class EntryCountMapTest { @Ignore("HCOLL-279 fix net.openhft.chronicle.map.EntryCountMapTest#testVerySmall") @Test - public void testVerySmall() throws Exception { + public void testVerySmall() throws IOException { System.out.print("testVerySmall seeds"); for (int t = 0; t < ecmTests; t++) { System.out.print("."); @@ -112,7 +109,7 @@ public class EntryCountMapTest { } @Test - public void testSmall() throws Exception { + public void testSmall() throws IOException, ExecutionException, InterruptedException { System.out.print("testSmall seeds"); int procs = Runtime.getRuntime().availableProcessors(); ExecutorService es = Executors.newFixedThreadPool(procs); @@ -156,7 +153,7 @@ public class EntryCountMapTest { @Ignore("Long running, large tests test") @Test - public void testMedium() throws Exception { + public void testMedium() throws IOException, ExecutionException, InterruptedException { System.out.print("testMedium seeds"); int procs = Runtime.getRuntime().availableProcessors(); ExecutorService es = Executors.newFixedThreadPool(procs); @@ -194,7 +191,7 @@ public class EntryCountMapTest { return es.submit(new Callable() { @Override - public Void call() throws Exception { + public Void call() { File f = null; try (final ChronicleMap map = getSharedMap(minSize, segments, maxKeySize)) { diff --git a/src/test/java/net/openhft/chronicle/map/IntIntMultiMapTest.java b/src/test/java/net/openhft/chronicle/map/IntIntMultiMapTest.java index 3eb8a9903..5f2b1e377 100644 --- a/src/test/java/net/openhft/chronicle/map/IntIntMultiMapTest.java +++ b/src/test/java/net/openhft/chronicle/map/IntIntMultiMapTest.java @@ -41,8 +41,7 @@ public class IntIntMultiMapTest { Multimap referenceMap = HashMultimap.create(); private Class c; - public IntIntMultiMapTest(Class c) - throws Exception { + public IntIntMultiMapTest(Class c) { this.c = c; } diff --git a/src/test/java/net/openhft/chronicle/map/ProcessInstanceLimiterMain.java b/src/test/java/net/openhft/chronicle/map/ProcessInstanceLimiterMain.java index dcbf248dc..76a09296a 100644 --- a/src/test/java/net/openhft/chronicle/map/ProcessInstanceLimiterMain.java +++ b/src/test/java/net/openhft/chronicle/map/ProcessInstanceLimiterMain.java @@ -45,7 +45,7 @@ public class ProcessInstanceLimiterMain implements Runnable { t.start(); } - public static void main(String[] args) throws Exception { + public static void main(String[] args) throws IOException, InterruptedException { Callback callback = new Callback() { public void tooManyProcessesOfType(String processType) { System.out.println("Too many processes of type " + processType + " have been started, so exiting this process"); diff --git a/src/test/java/net/openhft/chronicle/map/ReplicatedChronicleMapTest.java b/src/test/java/net/openhft/chronicle/map/ReplicatedChronicleMapTest.java index 08399540d..4def09f54 100644 --- a/src/test/java/net/openhft/chronicle/map/ReplicatedChronicleMapTest.java +++ b/src/test/java/net/openhft/chronicle/map/ReplicatedChronicleMapTest.java @@ -779,7 +779,7 @@ public class ReplicatedChronicleMapTest extends JSR166TestCase { /** * A deserialized map equals original */ - /* @Test public void testSerialization() throws Exception { + /* @Test public void testSerialization() { Map x = map5(); Map y = serialClone(x); diff --git a/src/test/java/net/openhft/chronicle/map/SerializerTest.java b/src/test/java/net/openhft/chronicle/map/SerializerTest.java index 8b1da25ea..d6fbd9692 100644 --- a/src/test/java/net/openhft/chronicle/map/SerializerTest.java +++ b/src/test/java/net/openhft/chronicle/map/SerializerTest.java @@ -33,7 +33,7 @@ import static org.junit.Assert.assertEquals; public class SerializerTest { @Test - public void testPrefixStringFunctionSerialization() throws Exception { + public void testPrefixStringFunctionSerialization() { ByteBufferBytes b = new ByteBufferBytes(ByteBuffer.allocate(512)); @@ -64,7 +64,7 @@ public class SerializerTest { @Test - public void testValueMarshallable() throws Exception { + public void testValueMarshallable() { testReadWriteValue("Test"); testReadWriteValue(1); testReadWriteValue(1L); @@ -80,7 +80,7 @@ public class SerializerTest { } @Test - public void testKeyMarshallable() throws Exception { + public void testKeyMarshallable() { testReadWriteKey("Test"); testReadWriteKey(1); testReadWriteKey(1L); @@ -95,7 +95,7 @@ public class SerializerTest { testReadWriteKey(new MyTestClassObjectGraph(3)); } - public void testReadWriteValue(Object value) throws Exception { + public void testReadWriteValue(Object value) { Class valueClass = value.getClass(); @@ -119,7 +119,7 @@ public class SerializerTest { Assert.assertEquals(actual, value); } - public void testReadWriteKey(Object key) throws Exception { + public void testReadWriteKey(Object key) { Class clazz = key.getClass(); diff --git a/src/test/java/net/openhft/chronicle/map/TcpReplicationWithAcquireUsingLockedTest.java b/src/test/java/net/openhft/chronicle/map/TcpReplicationWithAcquireUsingLockedTest.java index fa5e93b46..0f593a3c1 100644 --- a/src/test/java/net/openhft/chronicle/map/TcpReplicationWithAcquireUsingLockedTest.java +++ b/src/test/java/net/openhft/chronicle/map/TcpReplicationWithAcquireUsingLockedTest.java @@ -30,7 +30,7 @@ public class TcpReplicationWithAcquireUsingLockedTest { @Test - public void testReplicationWithAcquireUsingLocked() throws Exception { + public void testReplicationWithAcquireUsingLocked() throws InterruptedException { TcpTransportAndNetworkConfig config1 = TcpTransportAndNetworkConfig.of(8076); @@ -85,7 +85,7 @@ public class TcpReplicationWithAcquireUsingLockedTest { @Test - public void testReplicationWithEmptyOffHeapObject() throws Exception { + public void testReplicationWithEmptyOffHeapObject() throws InterruptedException { TcpTransportAndNetworkConfig config1 = TcpTransportAndNetworkConfig.of(8076); @@ -138,7 +138,7 @@ public class TcpReplicationWithAcquireUsingLockedTest { @Test - public void testReplicationWithOffHeapObject() throws Exception { + public void testReplicationWithOffHeapObject() throws InterruptedException { TcpTransportAndNetworkConfig config1 = TcpTransportAndNetworkConfig.of(8076); diff --git a/src/test/java/net/openhft/chronicle/map/TestReplication.java b/src/test/java/net/openhft/chronicle/map/TestReplication.java index 3a5679b99..edaf95f6f 100644 --- a/src/test/java/net/openhft/chronicle/map/TestReplication.java +++ b/src/test/java/net/openhft/chronicle/map/TestReplication.java @@ -21,6 +21,7 @@ import org.junit.Assert; import org.junit.Test; import java.io.File; +import java.io.IOException; import java.net.InetSocketAddress; /** @@ -71,7 +72,7 @@ public class TestReplication { * memory with the maps that is doing the update */ @Test - public void testReplicationUsingAProxyMapThatsUpdatedViaSharedMemory() throws Exception { + public void testReplicationUsingAProxyMapThatsUpdatedViaSharedMemory() throws IOException { ChronicleMap server1 = null; ChronicleMap server2 = null; diff --git a/src/test/java/net/openhft/chronicle/map/ipc/StateMachineTutorial.java b/src/test/java/net/openhft/chronicle/map/ipc/StateMachineTutorial.java index e221e41d8..0dcb15898 100644 --- a/src/test/java/net/openhft/chronicle/map/ipc/StateMachineTutorial.java +++ b/src/test/java/net/openhft/chronicle/map/ipc/StateMachineTutorial.java @@ -33,7 +33,7 @@ public class StateMachineTutorial { // // ************************************************************************* - public static void main(String[] args) throws Exception { + public static void main(String[] args) { ChronicleMap map = null; try { diff --git a/src/test/java/net/openhft/chronicle/map/jsr166/JSR166TestCase.java b/src/test/java/net/openhft/chronicle/map/jsr166/JSR166TestCase.java index 3457caa26..6d66bf24b 100644 --- a/src/test/java/net/openhft/chronicle/map/jsr166/JSR166TestCase.java +++ b/src/test/java/net/openhft/chronicle/map/jsr166/JSR166TestCase.java @@ -17,6 +17,7 @@ package net.openhft.chronicle.map.jsr166; import junit.framework.AssertionFailedError; +import net.openhft.lang.Jvm; import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -261,7 +262,7 @@ public class JSR166TestCase { * Triggers test case Assert.failure if interrupt status is set in the main thread. */ @After - public void tearDown() throws Exception { + public void tearDown() throws InterruptedException { Throwable t = threadFailure.getAndSet(null); if (t != null) { if (t instanceof Error) @@ -269,7 +270,7 @@ public class JSR166TestCase { else if (t instanceof RuntimeException) throw (RuntimeException) t; else if (t instanceof Exception) - throw (Exception) t; + throw Jvm.rethrow(t); else { AssertionFailedError afe = new AssertionFailedError(t.toString()); diff --git a/src/test/java/net/openhft/chronicle/map/jsr166/map/ChronicleMapTest.java b/src/test/java/net/openhft/chronicle/map/jsr166/map/ChronicleMapTest.java index 369c11871..48eb0c085 100644 --- a/src/test/java/net/openhft/chronicle/map/jsr166/map/ChronicleMapTest.java +++ b/src/test/java/net/openhft/chronicle/map/jsr166/map/ChronicleMapTest.java @@ -673,7 +673,7 @@ public class ChronicleMapTest extends JSR166TestCase { /** * A deserialized map equals original */ - /* @Test public void testSerialization() throws Exception { + /* @Test public void testSerialization() { Map x = map5(); Map y = serialClone(x); diff --git a/src/test/java/net/openhft/chronicle/map/jsr166/map/MapCheck.java b/src/test/java/net/openhft/chronicle/map/jsr166/map/MapCheck.java index 8f276d5c5..68dba0515 100644 --- a/src/test/java/net/openhft/chronicle/map/jsr166/map/MapCheck.java +++ b/src/test/java/net/openhft/chronicle/map/jsr166/map/MapCheck.java @@ -51,7 +51,7 @@ public class MapCheck { if (!b) throw new Error("Failed Assertion"); } - public static void main(String[] args) throws Exception { + public static void main(String[] args) throws IOException, ClassNotFoundException { int numTests = 20; int size = 36864; // about midway of HashMap resize interval @@ -360,7 +360,7 @@ public class MapCheck { reallyAssert(src.size() == dst.size()); } - static void serTest(int size) throws Exception { + static void serTest(int size) throws IOException, ClassNotFoundException { Map s = newMap(); if (!(s instanceof Serializable)) return; diff --git a/src/test/java/net/openhft/chronicle/map/utility/ProcessInstanceLimiter.java b/src/test/java/net/openhft/chronicle/map/utility/ProcessInstanceLimiter.java index dd09eadd2..dc22c2f8c 100644 --- a/src/test/java/net/openhft/chronicle/map/utility/ProcessInstanceLimiter.java +++ b/src/test/java/net/openhft/chronicle/map/utility/ProcessInstanceLimiter.java @@ -142,7 +142,7 @@ public class ProcessInstanceLimiter implements Runnable { t.start(); } - public static void main(String[] args) throws Exception { + public static void main(String[] args) throws IOException, InterruptedException { ProcessInstanceLimiter.limitTo(2); Thread.sleep(60L * 1000L); } diff --git a/src/test/java/net/openhft/chronicle/set/ChronicleSetBuilderTest.java b/src/test/java/net/openhft/chronicle/set/ChronicleSetBuilderTest.java index 9220f702c..29770373b 100644 --- a/src/test/java/net/openhft/chronicle/set/ChronicleSetBuilderTest.java +++ b/src/test/java/net/openhft/chronicle/set/ChronicleSetBuilderTest.java @@ -22,7 +22,7 @@ import org.junit.Test; public class ChronicleSetBuilderTest { @Test - public void test() throws Exception { + public void test() { try (ChronicleSet integers = ChronicleSetBuilder.of(Integer.class).create()) { for (int i = 0; i < 10; i++) {