--- jsr166/src/test/tck/ThreadPoolExecutorSubclassTest.java 2009/11/21 17:38:05 1.10 +++ jsr166/src/test/tck/ThreadPoolExecutorSubclassTest.java 2009/11/21 20:17:40 1.15 @@ -1201,6 +1201,7 @@ public class ThreadPoolExecutorSubclassT e.invokeAny(l); shouldThrow(); } catch (ExecutionException success) { + assertTrue(success.getCause() instanceof NullPointerException); } finally { joinPool(e); } @@ -1280,6 +1281,7 @@ public class ThreadPoolExecutorSubclassT future.get(); shouldThrow(); } catch (ExecutionException success) { + assertTrue(success.getCause() instanceof NullPointerException); } finally { joinPool(e); } @@ -1353,15 +1355,23 @@ public class ThreadPoolExecutorSubclassT * timed invokeAny(c) throws NPE if c has null elements */ public void testTimedInvokeAny3() throws Exception { + final CountDownLatch latch = new CountDownLatch(1); ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue(10)); try { ArrayList> l = new ArrayList>(); - l.add(new StringTask()); + l.add(new Callable() { + public String call() { + try { + latch.await(); + } catch (InterruptedException ok) {} + return TEST_STRING; + }}); l.add(null); e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (NullPointerException success) { } finally { + latch.countDown(); joinPool(e); } } @@ -1377,6 +1387,7 @@ public class ThreadPoolExecutorSubclassT e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (ExecutionException success) { + assertTrue(success.getCause() instanceof NullPointerException); } finally { joinPool(e); } @@ -1491,7 +1502,6 @@ public class ThreadPoolExecutorSubclassT assertEquals(2, result.size()); for (Future future : result) assertSame(TEST_STRING, future.get()); - } catch (ExecutionException success) { } finally { joinPool(e); }