91 |
|
Policy.setPolicy(policy); |
92 |
|
try { |
93 |
|
ExecutorService e = new DirectExecutorService(); |
94 |
< |
Future future = e.submit(new PrivilegedAction() { |
94 |
> |
Future future = e.submit(Executors.callable(new PrivilegedAction() { |
95 |
|
public Object run() { |
96 |
|
return TEST_STRING; |
97 |
< |
}}); |
97 |
> |
}})); |
98 |
|
|
99 |
|
Object result = future.get(); |
100 |
|
assertSame(TEST_STRING, result); |
121 |
|
Policy.setPolicy(policy); |
122 |
|
try { |
123 |
|
ExecutorService e = new DirectExecutorService(); |
124 |
< |
Future future = e.submit(new PrivilegedExceptionAction() { |
124 |
> |
Future future = e.submit(Executors.callable(new PrivilegedExceptionAction() { |
125 |
|
public Object run() { |
126 |
|
return TEST_STRING; |
127 |
< |
}}); |
127 |
> |
}})); |
128 |
|
|
129 |
|
Object result = future.get(); |
130 |
|
assertSame(TEST_STRING, result); |
151 |
|
Policy.setPolicy(policy); |
152 |
|
try { |
153 |
|
ExecutorService e = new DirectExecutorService(); |
154 |
< |
Future future = e.submit(new PrivilegedExceptionAction() { |
154 |
> |
Future future = e.submit(Executors.callable(new PrivilegedExceptionAction() { |
155 |
|
public Object run() throws Exception { |
156 |
|
throw new IndexOutOfBoundsException(); |
157 |
< |
}}); |
157 |
> |
}})); |
158 |
|
|
159 |
|
Object result = future.get(); |
160 |
|
shouldThrow(); |