Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6257235

setOption() and setExtendedOption() of JavacTool throws NullPointerException for undefined options

XMLWordPrintable

    • b47
    • generic
    • generic
    • Verified

      setOption() and setExtendedOption() of JavacTool throws NullPointerException for undefined options
      Please see the following code:
      <code>
      import javax.tools.*;
      public class Test1 {
          public static void test(String... args) {
              JavacTool javac = com.sun.tools.javac.Tool.create();
              javac.setOption("seetharam",".");
      javac.setExtendedOption("seetharam",".");
          }
          public static void main(String... arg){
              Test1 test = new Test1();
              test.test();
          }
      }
      </code>
      Output of the code:
      <output>
      bash-2.05b$ $b/javac Test1.java
      bash-2.05b$ $b/java Test1
      Exception in thread "main" java.lang.NullPointerException
              at com.sun.tools.javac.Tool.setOption1(Tool.java:142)
              at com.sun.tools.javac.Tool.setOption(Tool.java:157)
              at Test1.test(Test1.java:5)
              at Test1.main(Test1.java:9)
      </output>
      ###@###.### 2005-04-19 09:08:13 GMT

            ahe Peter Ahe
            savadhansunw Seetharama Avadhanam (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: