--- jsr166/src/test/tck/ExecutorsTest.java 2003/12/27 19:26:43 1.12 +++ jsr166/src/test/tck/ExecutorsTest.java 2004/01/19 15:49:02 1.13 @@ -337,17 +337,21 @@ public class ExecutorsTest extends JSR16 final ThreadGroup egroup = Thread.currentThread().getThreadGroup(); Runnable r = new Runnable() { public void run() { - Thread current = Thread.currentThread(); - threadAssertTrue(!current.isDaemon()); - threadAssertTrue(current.getPriority() == Thread.NORM_PRIORITY); - ThreadGroup g = current.getThreadGroup(); - SecurityManager s = System.getSecurityManager(); - if (s != null) - threadAssertTrue(g == s.getThreadGroup()); - else - threadAssertTrue(g == egroup); - String name = current.getName(); - threadAssertTrue(name.endsWith("thread-1")); + try { + Thread current = Thread.currentThread(); + threadAssertTrue(!current.isDaemon()); + threadAssertTrue(current.getPriority() == Thread.NORM_PRIORITY); + ThreadGroup g = current.getThreadGroup(); + SecurityManager s = System.getSecurityManager(); + if (s != null) + threadAssertTrue(g == s.getThreadGroup()); + else + threadAssertTrue(g == egroup); + String name = current.getName(); + threadAssertTrue(name.endsWith("thread-1")); + } catch (SecurityException ok) { + // Also pass if not allowed to change setting + } } }; ExecutorService e = Executors.newSingleThreadExecutor(Executors.defaultThreadFactory()); @@ -379,20 +383,23 @@ public class ExecutorsTest extends JSR16 final AccessControlContext thisacc = AccessController.getContext(); Runnable r = new Runnable() { public void run() { - Thread current = Thread.currentThread(); - threadAssertTrue(!current.isDaemon()); - threadAssertTrue(current.getPriority() == Thread.NORM_PRIORITY); - ThreadGroup g = current.getThreadGroup(); - SecurityManager s = System.getSecurityManager(); - if (s != null) - threadAssertTrue(g == s.getThreadGroup()); - else - threadAssertTrue(g == egroup); - String name = current.getName(); - threadAssertTrue(name.endsWith("thread-1")); - threadAssertTrue(thisccl == current.getContextClassLoader()); - threadAssertTrue(thisacc.equals(AccessController.getContext())); - } + try { + Thread current = Thread.currentThread(); + threadAssertTrue(!current.isDaemon()); + threadAssertTrue(current.getPriority() == Thread.NORM_PRIORITY); + ThreadGroup g = current.getThreadGroup(); + SecurityManager s = System.getSecurityManager(); + if (s != null) + threadAssertTrue(g == s.getThreadGroup()); + else + threadAssertTrue(g == egroup); + String name = current.getName(); + threadAssertTrue(name.endsWith("thread-1")); + threadAssertTrue(thisccl == current.getContextClassLoader()); + threadAssertTrue(thisacc.equals(AccessController.getContext())); + } catch(SecurityException ok) { + // Also pass if not allowed to change settings + } }; ExecutorService e = Executors.newSingleThreadExecutor(Executors.privilegedThreadFactory());