-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
7
-
generic
-
generic
Compiler thows incorrect exception with SecurityManager
<testcase>
import java.io.*;
import java.util.*;
import javax.tools.*;
class SManager extends SecurityManager {
}
public class Foo {
public static void main(String... arg) throws IOException {
System.setSecurityManager(new SManager());
JavaCompiler javac = ToolProvider.getSystemJavaCompiler();
StandardJavaFileManager javaFileManager =
javac.getStandardFileManager(null,null,null);
}
}
</testcase>
<output>
G:\trails>java Foo
javax.tools.ToolProvider: java.lang.ClassNotFoundException: com/sun/tools/javac/api/JavacTool; access denied (java.util.
PropertyPermission sun.tools.ToolProvider read)
javax.tools.ToolProvider: java.security.AccessControlException: access denied (java.util.PropertyPermission java.home re
ad); access denied (java.util.PropertyPermission sun.tools.ToolProvider read)
javax.tools.ToolProvider: Lazy.compilerClass == null; access denied (java.util.PropertyPermission sun.tools.ToolProvider
read)
Exception in thread "main" java.lang.NullPointerException
at Foo.main(Foo.java:13)
</output>
The above program throws NullPoniterException which is incorrect or can be documented.
<testcase>
import java.io.*;
import java.util.*;
import javax.tools.*;
class SManager extends SecurityManager {
}
public class Foo {
public static void main(String... arg) throws IOException {
System.setSecurityManager(new SManager());
JavaCompiler javac = ToolProvider.getSystemJavaCompiler();
StandardJavaFileManager javaFileManager =
javac.getStandardFileManager(null,null,null);
}
}
</testcase>
<output>
G:\trails>java Foo
javax.tools.ToolProvider: java.lang.ClassNotFoundException: com/sun/tools/javac/api/JavacTool; access denied (java.util.
PropertyPermission sun.tools.ToolProvider read)
javax.tools.ToolProvider: java.security.AccessControlException: access denied (java.util.PropertyPermission java.home re
ad); access denied (java.util.PropertyPermission sun.tools.ToolProvider read)
javax.tools.ToolProvider: Lazy.compilerClass == null; access denied (java.util.PropertyPermission sun.tools.ToolProvider
read)
Exception in thread "main" java.lang.NullPointerException
at Foo.main(Foo.java:13)
</output>
The above program throws NullPoniterException which is incorrect or can be documented.