75 |
|
try { |
76 |
|
f.join(); |
77 |
|
shouldThrow(); |
78 |
< |
} catch (Throwable ex) { |
79 |
< |
assertTrue(ex instanceof CompletionException && |
80 |
< |
((CompletionException)ex).getCause() instanceof CFException); |
78 |
> |
} catch (CompletionException success) { |
79 |
> |
assertTrue(success.getCause() instanceof CFException); |
80 |
|
} |
81 |
|
try { |
82 |
|
f.getNow(null); |
83 |
|
shouldThrow(); |
84 |
< |
} catch (Throwable ex) { |
85 |
< |
assertTrue(ex instanceof CompletionException && |
87 |
< |
((CompletionException)ex).getCause() instanceof CFException); |
84 |
> |
} catch (CompletionException success) { |
85 |
> |
assertTrue(success.getCause() instanceof CFException); |
86 |
|
} |
87 |
|
try { |
88 |
|
f.get(); |
89 |
|
shouldThrow(); |
90 |
< |
} catch (Throwable ex) { |
91 |
< |
assertTrue(ex instanceof ExecutionException && |
92 |
< |
((ExecutionException)ex).getCause() instanceof CFException); |
95 |
< |
} |
90 |
> |
} catch (ExecutionException success) { |
91 |
> |
assertTrue(success.getCause() instanceof CFException); |
92 |
> |
} catch (Throwable fail) { threadUnexpectedException(fail); } |
93 |
|
try { |
94 |
|
f.get(0L, SECONDS); |
95 |
|
shouldThrow(); |
96 |
< |
} catch (Throwable ex) { |
97 |
< |
assertTrue(ex instanceof ExecutionException && |
98 |
< |
((ExecutionException)ex).getCause() instanceof CFException); |
102 |
< |
} |
96 |
> |
} catch (ExecutionException success) { |
97 |
> |
assertTrue(success.getCause() instanceof CFException); |
98 |
> |
} catch (Throwable fail) { threadUnexpectedException(fail); } |
99 |
|
assertTrue(f.isDone()); |
100 |
|
assertFalse(f.isCancelled()); |
101 |
|
} |
104 |
|
try { |
105 |
|
f.join(); |
106 |
|
shouldThrow(); |
107 |
< |
} catch (Throwable ex) { |
112 |
< |
assertTrue(ex instanceof CancellationException); |
113 |
< |
} |
107 |
> |
} catch (CancellationException success) {} |
108 |
|
try { |
109 |
|
f.getNow(null); |
110 |
|
shouldThrow(); |
111 |
< |
} catch (Throwable ex) { |
118 |
< |
assertTrue(ex instanceof CancellationException); |
119 |
< |
} |
111 |
> |
} catch (CancellationException success) {} |
112 |
|
try { |
113 |
|
f.get(); |
114 |
|
shouldThrow(); |
115 |
< |
} catch (Throwable ex) { |
116 |
< |
assertTrue(ex instanceof CancellationException); |
125 |
< |
} |
115 |
> |
} catch (CancellationException success) { |
116 |
> |
} catch (Throwable fail) { threadUnexpectedException(fail); } |
117 |
|
try { |
118 |
|
f.get(0L, SECONDS); |
119 |
|
shouldThrow(); |
120 |
< |
} catch (Throwable ex) { |
121 |
< |
assertTrue(ex instanceof CancellationException); |
131 |
< |
} |
120 |
> |
} catch (CancellationException success) { |
121 |
> |
} catch (Throwable fail) { threadUnexpectedException(fail); } |
122 |
|
assertTrue(f.isDone()); |
123 |
|
assertTrue(f.isCancelled()); |
124 |
|
} |
127 |
|
try { |
128 |
|
f.join(); |
129 |
|
shouldThrow(); |
130 |
< |
} catch (Throwable ex) { |
131 |
< |
assertTrue(ex instanceof CompletionException && |
142 |
< |
((CompletionException)ex).getCause() instanceof CancellationException); |
130 |
> |
} catch (CompletionException success) { |
131 |
> |
assertTrue(success.getCause() instanceof CancellationException); |
132 |
|
} |
133 |
|
try { |
134 |
|
f.getNow(null); |
135 |
|
shouldThrow(); |
136 |
< |
} catch (Throwable ex) { |
137 |
< |
assertTrue(ex instanceof CompletionException && |
149 |
< |
((CompletionException)ex).getCause() instanceof CancellationException); |
136 |
> |
} catch (CompletionException success) { |
137 |
> |
assertTrue(success.getCause() instanceof CancellationException); |
138 |
|
} |
139 |
|
try { |
140 |
|
f.get(); |
141 |
|
shouldThrow(); |
142 |
< |
} catch (Throwable ex) { |
143 |
< |
assertTrue(ex instanceof ExecutionException && |
144 |
< |
((ExecutionException)ex).getCause() instanceof CancellationException); |
157 |
< |
} |
142 |
> |
} catch (ExecutionException success) { |
143 |
> |
assertTrue(success.getCause() instanceof CancellationException); |
144 |
> |
} catch (Throwable fail) { threadUnexpectedException(fail); } |
145 |
|
try { |
146 |
|
f.get(0L, SECONDS); |
147 |
|
shouldThrow(); |
148 |
< |
} catch (Throwable ex) { |
149 |
< |
assertTrue(ex instanceof ExecutionException && |
150 |
< |
((ExecutionException)ex).getCause() instanceof CancellationException); |
164 |
< |
} |
148 |
> |
} catch (ExecutionException success) { |
149 |
> |
assertTrue(success.getCause() instanceof CancellationException); |
150 |
> |
} catch (Throwable fail) { threadUnexpectedException(fail); } |
151 |
|
assertTrue(f.isDone()); |
152 |
|
assertFalse(f.isCancelled()); |
153 |
|
} |