equal
deleted
inserted
replaced
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
20 * or visit www.oracle.com if you need additional information or have any |
20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. |
21 * questions. |
22 */ |
22 */ |
23 |
23 |
|
24 import java.nio.file.Files; |
|
25 import java.nio.file.Path; |
|
26 import java.nio.file.Paths; |
|
27 import java.util.Objects; |
24 import javax.tools.ToolProvider; |
28 import javax.tools.ToolProvider; |
25 import java.util.Objects; |
|
26 |
29 |
27 /** |
30 /** |
28 * @test |
31 * @test |
29 * @bug 8154190 |
32 * @bug 8154190 |
30 * @summary Test javax.tools.ToolProvider running with security manager |
33 * @summary Test javax.tools.ToolProvider running with security manager |
34 */ |
37 */ |
35 |
38 |
36 // run in other vm to ensure the initialization code path is exercised. |
39 // run in other vm to ensure the initialization code path is exercised. |
37 public class ToolProviderTest { |
40 public class ToolProviderTest { |
38 public static void main(String... args) { |
41 public static void main(String... args) { |
|
42 // The following code allows the test to be skipped when run on |
|
43 // an exploded image. |
|
44 // See https://bugs.openjdk.java.net/browse/JDK-8155858 |
|
45 Path javaHome = Paths.get(System.getProperty("java.home")); |
|
46 Path image = javaHome.resolve("lib").resolve("modules"); |
|
47 Path modules = javaHome.resolve("modules"); |
|
48 if (!Files.exists(image) && Files.exists(modules)) { |
|
49 System.err.println("Test running on exploded image"); |
|
50 System.err.println("Test skipped!"); |
|
51 return; |
|
52 } |
|
53 |
39 System.setSecurityManager(new SecurityManager()); |
54 System.setSecurityManager(new SecurityManager()); |
40 |
55 |
41 Objects.requireNonNull(ToolProvider.getSystemDocumentationTool()); |
56 Objects.requireNonNull(ToolProvider.getSystemDocumentationTool()); |
42 Objects.requireNonNull(ToolProvider.getSystemJavaCompiler()); |
57 Objects.requireNonNull(ToolProvider.getSystemJavaCompiler()); |
43 Objects.requireNonNull(ToolProvider.getSystemToolClassLoader()); |
58 Objects.requireNonNull(ToolProvider.getSystemToolClassLoader()); |