changeset 1471:f93753325c7b

8139852: jjs interactive mode fails to work with security manager Reviewed-by: attila, hannesw
author sundar
date Mon, 19 Oct 2015 15:49:21 +0530
parents 335632718c1e
children 1faacf3cd85f
files src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/PackagesHelper.java
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/PackagesHelper.java	Mon Oct 19 08:45:29 2015 +0200
+++ b/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/PackagesHelper.java	Mon Oct 19 15:49:21 2015 +0530
@@ -51,7 +51,11 @@
  */
 final class PackagesHelper {
     // JavaCompiler may be null on certain platforms (eg. JRE)
-    private static final JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+    private static final JavaCompiler compiler;
+    static {
+        // Use javac only if security manager is not around!
+        compiler = System.getSecurityManager() == null? ToolProvider.getSystemJavaCompiler() : null;
+    }
 
     /**
      * Is Java package properties helper available?