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

Comparing jsr166/src/test/tck/ForkJoinPool9Test.java (file contents):
Revision 1.1 by jsr166, Sun Jan 29 20:19:00 2017 UTC vs.
Revision 1.2 by jsr166, Tue Jan 31 01:44:39 2017 UTC

# Line 30 | Line 30 | public class ForkJoinPool9Test extends J
30              MethodHandles.privateLookupIn(Thread.class, MethodHandles.lookup())
31              .findVarHandle(Thread.class, "contextClassLoader", ClassLoader.class);
32          ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
33 <        //if (System.getSecurityManager() == null) return;
33 >        boolean haveSecurityManager = (System.getSecurityManager() != null);
34          CompletableFuture.runAsync(
35              () -> {
36                  assertSame(systemClassLoader,
37                             Thread.currentThread().getContextClassLoader());
38                  assertSame(systemClassLoader,
39                             CCL.get(Thread.currentThread()));
40 +                if (haveSecurityManager)
41 +                    assertThrows(
42 +                        SecurityException.class,
43 +                        () -> System.getProperty("foo"),
44 +                        () -> Thread.currentThread().setContextClassLoader(null));
45 +
46 +                // TODO ?
47 + //                 if (haveSecurityManager
48 + //                     && Thread.currentThread().getClass().getSimpleName()
49 + //                     .equals("InnocuousForkJoinWorkerThread"))
50 + //                     assertThrows(SecurityException.class, /* ?? */);
51              }).join();
52      }
53  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines