T6625520.java revision 57
0N/A/*
1879N/A * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
1472N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
1472N/A * CA 95054 USA or visit www.sun.com if you need additional information or
1472N/A * have any questions.
0N/A */
0N/A
0N/Aimport java.io.*;
1879N/Aimport java.util.*;
1879N/Aimport javax.tools.*;
1879N/Aimport com.sun.tools.javac.file.*;
1879N/Aimport com.sun.tools.javac.file.JavacFileManager;
1879N/Aimport com.sun.tools.javac.util.*;
1879N/A
1879N/A/*
1879N/A * @test
1879N/A * @bug 6625520
0N/A * @summary javac handles missing entries on classpath badly
0N/A */
0N/Apublic class T6625520 {
0N/A public static void main(String[] args) throws Exception {
0N/A new T6625520().run();
0N/A }
0N/A
0N/A void run() throws Exception {
0N/A Context c = new Context();
0N/A DiagnosticCollector<JavaFileObject> dc =
0N/A new DiagnosticCollector<JavaFileObject>();
0N/A c.put(DiagnosticListener.class, dc);
0N/A StandardJavaFileManager fm = new JavacFileManager(c, false, null);
0N/A fm.setLocation(StandardLocation.CLASS_PATH,
0N/A Arrays.asList(new File("DOES_NOT_EXIST.jar")));
0N/A FileObject fo = fm.getFileForInput(StandardLocation.CLASS_PATH,
0N/A "p", "C.java");
0N/A System.err.println(fo + "\n" + dc.getDiagnostics());
0N/A if (dc.getDiagnostics().size() > 0)
0N/A throw new Exception("unexpected diagnostics found");
0N/A }
0N/A}
0N/A