JDK-6410643 : JSR 199: The method JavaCompilerTool.run fails to handle null arguments
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2006-04-09
  • Updated: 2016-04-19
  • Resolved: 2006-05-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6 b85Fixed
Related Reports
Relates :  
Relates :  
Description
The method JavaCompilerTool.run fails to handle null arguments.
<code>
import javax.tools.JavaCompilerTool;
import javax.tools.ToolProvider;

public class Foo {
    public static void main(String... arg) {
        JavaCompilerTool jct = ToolProvider.getSystemJavaCompilerTool();
        jct.run(null,null,null,"Foo.java",null);
    }
}
</code>
<output>
E:\MustangTestDev\tools\jsr199\ToolTest\ToolTest01>java Foo
An exception has occurred in the compiler (1.6.0-auto). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport)  af
ter checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report.  Thank you.
java.lang.NullPointerException
        at com.sun.tools.javac.main.CommandLine.parse(CommandLine.java:47)
        at com.sun.tools.javac.main.Main.compile(Main.java:288)
        at com.sun.tools.javac.main.Main.compile(Main.java:255)
        at com.sun.tools.javac.main.Main.compile(Main.java:246)
        at com.sun.tools.javac.Main.compile(Main.java:88)
        at com.sun.tools.javac.api.JavacTool.run(JavacTool.java:304)
        at Foo.main(Foo.java:7)

</output>
<java-version>
java version "1.6.0-auto"
Java(TM) SE Runtime Environment (build 1.6.0-auto-087)
Java HotSpot(TM) Client VM (build 1.6.0-beta2-b78, mixed mode)
</java-version>

Comments
EVALUATION A bug: the compiler should throw a null pointer exception, not output a message. Also, the specification should also be clarified to mention that the "arguments" array may not contain null elements.
21-04-2006