ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/ExecutorsTest.java
(Generate patch)

Comparing jsr166/src/test/tck/ExecutorsTest.java (file contents):
Revision 1.12 by dl, Sat Dec 27 19:26:43 2003 UTC vs.
Revision 1.13 by dl, Mon Jan 19 15:49:02 2004 UTC

# Line 337 | Line 337 | public class ExecutorsTest extends JSR16
337          final ThreadGroup egroup = Thread.currentThread().getThreadGroup();
338          Runnable r = new Runnable() {
339                  public void run() {
340 <                    Thread current = Thread.currentThread();
341 <                    threadAssertTrue(!current.isDaemon());
342 <                    threadAssertTrue(current.getPriority() == Thread.NORM_PRIORITY);
343 <                    ThreadGroup g = current.getThreadGroup();
344 <                    SecurityManager s = System.getSecurityManager();
345 <                    if (s != null)
346 <                        threadAssertTrue(g == s.getThreadGroup());
347 <                    else
348 <                        threadAssertTrue(g == egroup);
349 <                    String name = current.getName();
350 <                    threadAssertTrue(name.endsWith("thread-1"));
340 >                    try {
341 >                        Thread current = Thread.currentThread();
342 >                        threadAssertTrue(!current.isDaemon());
343 >                        threadAssertTrue(current.getPriority() == Thread.NORM_PRIORITY);
344 >                        ThreadGroup g = current.getThreadGroup();
345 >                        SecurityManager s = System.getSecurityManager();
346 >                        if (s != null)
347 >                            threadAssertTrue(g == s.getThreadGroup());
348 >                        else
349 >                            threadAssertTrue(g == egroup);
350 >                        String name = current.getName();
351 >                        threadAssertTrue(name.endsWith("thread-1"));
352 >                    } catch (SecurityException ok) {
353 >                        // Also pass if not allowed to change setting
354 >                    }
355                  }
356              };
357          ExecutorService e = Executors.newSingleThreadExecutor(Executors.defaultThreadFactory());
# Line 379 | Line 383 | public class ExecutorsTest extends JSR16
383          final AccessControlContext thisacc = AccessController.getContext();
384          Runnable r = new Runnable() {
385                  public void run() {
386 <                    Thread current = Thread.currentThread();
387 <                    threadAssertTrue(!current.isDaemon());
388 <                    threadAssertTrue(current.getPriority() == Thread.NORM_PRIORITY);
389 <                    ThreadGroup g = current.getThreadGroup();
390 <                    SecurityManager s = System.getSecurityManager();
391 <                    if (s != null)
392 <                        threadAssertTrue(g == s.getThreadGroup());
393 <                    else
394 <                        threadAssertTrue(g == egroup);
395 <                    String name = current.getName();
396 <                    threadAssertTrue(name.endsWith("thread-1"));
397 <                    threadAssertTrue(thisccl == current.getContextClassLoader());
398 <                    threadAssertTrue(thisacc.equals(AccessController.getContext()));
399 <                }
386 >                    try {
387 >                        Thread current = Thread.currentThread();
388 >                        threadAssertTrue(!current.isDaemon());
389 >                        threadAssertTrue(current.getPriority() == Thread.NORM_PRIORITY);
390 >                        ThreadGroup g = current.getThreadGroup();
391 >                        SecurityManager s = System.getSecurityManager();
392 >                        if (s != null)
393 >                            threadAssertTrue(g == s.getThreadGroup());
394 >                        else
395 >                            threadAssertTrue(g == egroup);
396 >                        String name = current.getName();
397 >                        threadAssertTrue(name.endsWith("thread-1"));
398 >                        threadAssertTrue(thisccl == current.getContextClassLoader());
399 >                        threadAssertTrue(thisacc.equals(AccessController.getContext()));
400 >                    } catch(SecurityException ok) {
401 >                        // Also pass if not allowed to change settings
402 >                    }
403              };
404          ExecutorService e = Executors.newSingleThreadExecutor(Executors.privilegedThreadFactory());
405          

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines