170 |
|
try { |
171 |
|
new ForkJoinPool(-1); |
172 |
|
shouldThrow(); |
173 |
< |
} |
174 |
< |
catch (IllegalArgumentException success) {} |
173 |
> |
} catch (IllegalArgumentException success) {} |
174 |
|
} |
175 |
|
|
176 |
|
/** |
180 |
|
try { |
181 |
|
new ForkJoinPool(1, null); |
182 |
|
shouldThrow(); |
183 |
< |
} catch (NullPointerException success) { |
185 |
< |
} |
183 |
> |
} catch (NullPointerException success) {} |
184 |
|
} |
185 |
|
|
186 |
|
|
412 |
|
p.execute(f); |
413 |
|
assertTrue(p.getPoolSize() >= 4); |
414 |
|
int r = f.get(); |
415 |
< |
assertTrue(r == 832040); |
415 |
> |
assertTrue(r == 832040); |
416 |
|
} finally { |
417 |
|
p.shutdownNow(); // don't wait out shutdown |
418 |
|
} |
590 |
|
Object result = future.get(); |
591 |
|
shouldThrow(); |
592 |
|
} catch (ExecutionException success) { |
593 |
+ |
assertTrue(success.getCause() instanceof IndexOutOfBoundsException); |
594 |
|
} finally { |
595 |
|
Policy.setPolicy(savedPolicy); |
596 |
|
} |
605 |
|
TrackedShortRunnable task = null; |
606 |
|
Future<?> future = e.submit(task); |
607 |
|
shouldThrow(); |
608 |
< |
} catch (NullPointerException success) { |
610 |
< |
} |
608 |
> |
} catch (NullPointerException success) {} |
609 |
|
} |
610 |
|
|
611 |
|
|
618 |
|
StringTask t = null; |
619 |
|
Future<String> future = e.submit(t); |
620 |
|
shouldThrow(); |
621 |
< |
} catch (NullPointerException success) { |
624 |
< |
} |
621 |
> |
} catch (NullPointerException success) {} |
622 |
|
} |
623 |
|
|
624 |
|
|
630 |
|
final ForkJoinPool p = new ForkJoinPool(1); |
631 |
|
|
632 |
|
Thread t = new Thread(new CheckedInterruptedRunnable() { |
633 |
< |
void realRun() throws Throwable { |
633 |
> |
public void realRun() throws Throwable { |
634 |
|
p.submit(new CheckedCallable<Object>() { |
635 |
|
public Object realCall() throws Throwable { |
636 |
|
try { |
663 |
|
}}).get(); |
664 |
|
shouldThrow(); |
665 |
|
} catch (ExecutionException success) { |
666 |
+ |
assertTrue(success.getCause() instanceof ArithmeticException); |
667 |
|
} |
668 |
+ |
|
669 |
|
joinPool(p); |
670 |
|
} |
671 |
|
|
747 |
|
e.invokeAny(l); |
748 |
|
shouldThrow(); |
749 |
|
} catch (ExecutionException success) { |
750 |
+ |
assertTrue(success.getCause() instanceof NullPointerException); |
751 |
|
} finally { |
752 |
|
joinPool(e); |
753 |
|
} |
829 |
|
future.get(); |
830 |
|
shouldThrow(); |
831 |
|
} catch (ExecutionException success) { |
832 |
+ |
assertTrue(success.getCause() instanceof NullPointerException); |
833 |
|
} finally { |
834 |
|
joinPool(e); |
835 |
|
} |
903 |
|
* timed invokeAny(c) throws NullPointerException if c has null elements |
904 |
|
*/ |
905 |
|
public void testTimedInvokeAny3() throws Throwable { |
906 |
+ |
final CountDownLatch latch = new CountDownLatch(1); |
907 |
|
ExecutorService e = new ForkJoinPool(1); |
908 |
|
try { |
909 |
|
ArrayList<Callable<String>> l = new ArrayList<Callable<String>>(); |
910 |
< |
l.add(new StringTask()); |
910 |
> |
l.add(new Callable<String>() { |
911 |
> |
public String call() { |
912 |
> |
try { |
913 |
> |
latch.await(); |
914 |
> |
} catch (InterruptedException ok) {} |
915 |
> |
return TEST_STRING; |
916 |
> |
}}); |
917 |
|
l.add(null); |
918 |
|
e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS); |
919 |
|
shouldThrow(); |
920 |
|
} catch (NullPointerException success) { |
921 |
|
} finally { |
922 |
+ |
latch.countDown(); |
923 |
|
joinPool(e); |
924 |
|
} |
925 |
|
} |
935 |
|
e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS); |
936 |
|
shouldThrow(); |
937 |
|
} catch (ExecutionException success) { |
938 |
+ |
assertTrue(success.getCause() instanceof NullPointerException); |
939 |
|
} finally { |
940 |
|
joinPool(e); |
941 |
|
} |
1034 |
|
future.get(); |
1035 |
|
shouldThrow(); |
1036 |
|
} catch (ExecutionException success) { |
1037 |
+ |
assertTrue(success.getCause() instanceof NullPointerException); |
1038 |
|
} finally { |
1039 |
|
joinPool(e); |
1040 |
|
} |