diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java index 4372b3a6cc5..7e8e6284964 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java @@ -22,7 +22,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; import org.eclipse.cdt.dsf.concurrent.CountingRequestMonitor; import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor; @@ -632,9 +634,11 @@ public class SyncUtil { * * @return the process context * @throws InterruptedException + * @throws TimeoutException + * @throws ExecutionException */ @ThreadSafeAndProhibitedFromDsfExecutor("fSession.getExecutor()") - public static IContainerDMContext getContainerContext() throws InterruptedException { + public static IContainerDMContext getContainerContext() throws InterruptedException, ExecutionException, TimeoutException { assert !fProcessesService.getExecutor().isInExecutorThread(); Query query = new Query() { @@ -661,19 +665,16 @@ public class SyncUtil { }; fGdbControl.getExecutor().execute(query); - try { - return query.get(TestsPlugin.massageTimeout(2000), TimeUnit.MILLISECONDS); - } catch (Exception e) { - fail(e.getMessage()); - } - return null; + return query.get(TestsPlugin.massageTimeout(2000), TimeUnit.MILLISECONDS); } /** * Utility method to return all thread execution contexts. + * @throws TimeoutException + * @throws ExecutionException */ @ThreadSafeAndProhibitedFromDsfExecutor("fSession.getExecutor()") - public static IMIExecutionDMContext[] getExecutionContexts() throws InterruptedException { + public static IMIExecutionDMContext[] getExecutionContexts() throws InterruptedException, ExecutionException, TimeoutException { assert !fProcessesService.getExecutor().isInExecutorThread(); final IContainerDMContext containerDmc = SyncUtil.getContainerContext(); @@ -700,18 +701,16 @@ public class SyncUtil { }; fGdbControl.getExecutor().execute(query); - try { - return query.get(TestsPlugin.massageTimeout(2000), TimeUnit.MILLISECONDS); - } catch (Exception e) { - fail(e.getMessage()); - } - return null; + return query.get(TestsPlugin.massageTimeout(2000), TimeUnit.MILLISECONDS); } + /** * Utility method to return a specific execution DM context. + * @throws TimeoutException + * @throws ExecutionException */ @ThreadSafeAndProhibitedFromDsfExecutor("fSession.getExecutor()") - public static IMIExecutionDMContext getExecutionContext(int threadIndex) throws InterruptedException { + public static IMIExecutionDMContext getExecutionContext(int threadIndex) throws InterruptedException, ExecutionException, TimeoutException { IMIExecutionDMContext[] threads = getExecutionContexts(); assertTrue("unexpected number of threads", threadIndex < threads.length); assertNotNull("unexpected thread context type ", threads[threadIndex]); diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBProcessesTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBProcessesTest.java index 22eca349e66..a977ae2ff77 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBProcessesTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBProcessesTest.java @@ -16,6 +16,8 @@ package org.eclipse.cdt.tests.dsf.gdb.tests; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeoutException; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -95,7 +97,7 @@ public class GDBProcessesTest extends BaseTestCase { /* * Get the process data for the current program. Process is executable name in case of GDB back end */ - public void getProcessData() throws InterruptedException{ + public void getProcessData() throws InterruptedException, ExecutionException, TimeoutException { /* * Create a request monitor @@ -150,7 +152,7 @@ public class GDBProcessesTest extends BaseTestCase { * getThreadData() for multiple threads */ @Test - public void getThreadData() throws InterruptedException{ + public void getThreadData() throws InterruptedException, ExecutionException, TimeoutException { final String THREAD_ID = "1"; final DataRequestMonitor rm = diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTest.java index a55c6037afe..11d6d439881 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTest.java @@ -20,6 +20,8 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.util.Arrays; import java.util.LinkedList; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeoutException; import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor; @@ -187,7 +189,7 @@ public class MIRunControlTest extends BaseTestCase { * For Multi-threaded application - In case of one thread, Thread id should start with 1. */ @Test - public void getExecutionContext() throws InterruptedException{ + public void getExecutionContext() throws InterruptedException, ExecutionException, TimeoutException { final AsyncCompletionWaitor wait = new AsyncCompletionWaitor(); /* * Create a request monitor @@ -334,7 +336,7 @@ public class MIRunControlTest extends BaseTestCase { * Testing getModelData() for ExecutionDMC */ @Test - public void getModelDataForThread() throws InterruptedException{ + public void getModelDataForThread() throws InterruptedException, ExecutionException, TimeoutException { final AsyncCompletionWaitor wait = new AsyncCompletionWaitor(); /* * Create a request monitor @@ -572,7 +574,7 @@ public class MIRunControlTest extends BaseTestCase { //Also test Cache after ContainerResumeEvent @Test - public void resume() throws InterruptedException{ + public void resume() throws InterruptedException, ExecutionException, TimeoutException { final AsyncCompletionWaitor wait = new AsyncCompletionWaitor(); final DataRequestMonitor rm = @@ -624,7 +626,7 @@ public class MIRunControlTest extends BaseTestCase { } @Test - public void resumeContainerContext() throws InterruptedException{ + public void resumeContainerContext() throws InterruptedException, ExecutionException, TimeoutException { final AsyncCompletionWaitor wait = new AsyncCompletionWaitor(); final DataRequestMonitor rm =