test/tools/javac/T6405099.java

changeset 290
d4828eba4939
parent 1
9a66ca7c79fa
child 554
9d9f26857129
     1.1 --- a/test/tools/javac/T6405099.java	Wed May 27 22:34:43 2009 -0700
     1.2 +++ b/test/tools/javac/T6405099.java	Thu May 28 09:49:56 2009 -0700
     1.3 @@ -25,20 +25,39 @@
     1.4   * @test
     1.5   * @bug 6405099
     1.6   * @summary Compiler crashes when javac encounters /usr/jdk/packges/lib/ext with no 777 permissions
     1.7 - *
     1.8 - * @ignore causes NPE in Java Test
     1.9 - * @run main T6405099
    1.10 - * @compile -extdirs bad T6405099.java
    1.11   */
    1.12  
    1.13 -import java.io.File;
    1.14 +import java.io.*;
    1.15  
    1.16  public class T6405099
    1.17  {
    1.18      public static void main(String[] args) {
    1.19          File bad = new File("bad");
    1.20 -        bad.mkdir();
    1.21 -        bad.setReadable(false);
    1.22 -        bad.setExecutable(false);
    1.23 +        try {
    1.24 +            bad.mkdir();
    1.25 +            bad.setReadable(false);
    1.26 +            bad.setExecutable(false);
    1.27 +
    1.28 +            test(bad);
    1.29 +
    1.30 +        } finally {
    1.31 +            bad.setExecutable(true);
    1.32 +            bad.setReadable(true);
    1.33 +        }
    1.34 +    }
    1.35 +
    1.36 +    static void test(File dir) {
    1.37 +        String[] args = {
    1.38 +            "-extdirs", dir.getPath(), "-d", ".",
    1.39 +            new File(System.getProperty("test.src", "."), "T6405099.java").getPath()
    1.40 +        };
    1.41 +
    1.42 +        StringWriter sw = new StringWriter();
    1.43 +        PrintWriter pw = new PrintWriter(sw);
    1.44 +        int rc = com.sun.tools.javac.Main.compile(args, pw);
    1.45 +        if (rc != 0)
    1.46 +            throw new Error("compilation failed");
    1.47 +
    1.48 +        System.out.println(sw);
    1.49      }
    1.50  }

mercurial