8139852: jjs interactive mode fails to work with security manager
Reviewed-by: attila, hannesw
--- a/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/PackagesHelper.java Mon Oct 19 08:45:29 2015 +0200
+++ b/nashorn/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?