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