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.24 by jsr166, Fri Nov 20 22:58:48 2009 UTC vs.
Revision 1.25 by jsr166, Sat Nov 21 02:07:26 2009 UTC

# Line 304 | Line 304 | public class ExecutorsTest extends JSR16
304          final ThreadGroup egroup = Thread.currentThread().getThreadGroup();
305          Runnable r = new Runnable() {
306                  public void run() {
307 <                    try {
308 <                        Thread current = Thread.currentThread();
309 <                        threadAssertTrue(!current.isDaemon());
310 <                        threadAssertTrue(current.getPriority() <= Thread.NORM_PRIORITY);
311 <                        ThreadGroup g = current.getThreadGroup();
312 <                        SecurityManager s = System.getSecurityManager();
313 <                        if (s != null)
314 <                            threadAssertTrue(g == s.getThreadGroup());
315 <                        else
316 <                            threadAssertTrue(g == egroup);
317 <                        String name = current.getName();
318 <                        threadAssertTrue(name.endsWith("thread-1"));
319 <                    } catch (SecurityException ok) {
320 <                        // Also pass if not allowed to change setting
321 <                    }
307 >                    try {
308 >                        Thread current = Thread.currentThread();
309 >                        threadAssertTrue(!current.isDaemon());
310 >                        threadAssertTrue(current.getPriority() <= Thread.NORM_PRIORITY);
311 >                        ThreadGroup g = current.getThreadGroup();
312 >                        SecurityManager s = System.getSecurityManager();
313 >                        if (s != null)
314 >                            threadAssertTrue(g == s.getThreadGroup());
315 >                        else
316 >                            threadAssertTrue(g == egroup);
317 >                        String name = current.getName();
318 >                        threadAssertTrue(name.endsWith("thread-1"));
319 >                    } catch (SecurityException ok) {
320 >                        // Also pass if not allowed to change setting
321 >                    }
322                  }
323              };
324          ExecutorService e = Executors.newSingleThreadExecutor(Executors.defaultThreadFactory());
# Line 357 | Line 357 | public class ExecutorsTest extends JSR16
357          final AccessControlContext thisacc = AccessController.getContext();
358          Runnable r = new Runnable() {
359                  public void run() {
360 <                    try {
361 <                        Thread current = Thread.currentThread();
362 <                        threadAssertTrue(!current.isDaemon());
363 <                        threadAssertTrue(current.getPriority() <= Thread.NORM_PRIORITY);
364 <                        ThreadGroup g = current.getThreadGroup();
365 <                        SecurityManager s = System.getSecurityManager();
366 <                        if (s != null)
367 <                            threadAssertTrue(g == s.getThreadGroup());
368 <                        else
369 <                            threadAssertTrue(g == egroup);
370 <                        String name = current.getName();
371 <                        threadAssertTrue(name.endsWith("thread-1"));
372 <                        threadAssertTrue(thisccl == current.getContextClassLoader());
373 <                        threadAssertTrue(thisacc.equals(AccessController.getContext()));
374 <                    } catch (SecurityException ok) {
375 <                        // Also pass if not allowed to change settings
376 <                    }
360 >                    try {
361 >                        Thread current = Thread.currentThread();
362 >                        threadAssertTrue(!current.isDaemon());
363 >                        threadAssertTrue(current.getPriority() <= Thread.NORM_PRIORITY);
364 >                        ThreadGroup g = current.getThreadGroup();
365 >                        SecurityManager s = System.getSecurityManager();
366 >                        if (s != null)
367 >                            threadAssertTrue(g == s.getThreadGroup());
368 >                        else
369 >                            threadAssertTrue(g == egroup);
370 >                        String name = current.getName();
371 >                        threadAssertTrue(name.endsWith("thread-1"));
372 >                        threadAssertTrue(thisccl == current.getContextClassLoader());
373 >                        threadAssertTrue(thisacc.equals(AccessController.getContext()));
374 >                    } catch (SecurityException ok) {
375 >                        // Also pass if not allowed to change settings
376 >                    }
377                  }
378              };
379          ExecutorService e = Executors.newSingleThreadExecutor(Executors.privilegedThreadFactory());
# Line 413 | Line 413 | public class ExecutorsTest extends JSR16
413       * privilegedCallableUsingCurrentClassLoader throws ACE
414       */
415      public void testCreatePrivilegedCallableUsingCCLWithNoPrivs() {
416 <        Policy savedPolicy = null;
416 >        Policy savedPolicy = null;
417          try {
418              savedPolicy = Policy.getPolicy();
419              AdjustablePolicy policy = new AdjustablePolicy();
# Line 445 | Line 445 | public class ExecutorsTest extends JSR16
445       * privilegedCallableUsingCurrentClassLoader does not throw ACE
446       */
447      public void testprivilegedCallableUsingCCLWithPrivs() throws Exception {
448 <        Policy savedPolicy = null;
448 >        Policy savedPolicy = null;
449          try {
450              savedPolicy = Policy.getPolicy();
451              AdjustablePolicy policy = new AdjustablePolicy();
# Line 506 | Line 506 | public class ExecutorsTest extends JSR16
506       * With permissions, calling privilegedCallable succeeds
507       */
508      public void testprivilegedCallableWithPrivs() throws Exception {
509 <        Policy savedPolicy = null;
509 >        Policy savedPolicy = null;
510          try {
511              savedPolicy = Policy.getPolicy();
512              AdjustablePolicy policy = new AdjustablePolicy();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines