jjg@38: /* jjg@38: * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved. jjg@38: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. jjg@38: * jjg@38: * This code is free software; you can redistribute it and/or modify it jjg@38: * under the terms of the GNU General Public License version 2 only, as jjg@38: * published by the Free Software Foundation. jjg@38: * jjg@38: * This code is distributed in the hope that it will be useful, but WITHOUT jjg@38: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or jjg@38: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License jjg@38: * version 2 for more details (a copy is included in the LICENSE file that jjg@38: * accompanied this code). jjg@38: * jjg@38: * You should have received a copy of the GNU General Public License version jjg@38: * 2 along with this work; if not, write to the Free Software Foundation, jjg@38: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. jjg@38: * jjg@38: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, jjg@38: * CA 95054 USA or visit www.sun.com if you need additional information or jjg@38: * have any questions. jjg@38: */ jjg@38: jjg@38: /* jjg@38: * @test jjg@38: * @bug 6705935 jjg@38: * @summary javac reports path name of entry in ZipFileIndex incorectly jjg@38: */ jjg@38: jjg@38: import java.io.*; jjg@38: import java.util.*; jjg@38: import javax.tools.*; jjg@50: import com.sun.tools.javac.file.*; jjg@38: jjg@38: public class T6705935 { jjg@38: public static void main(String... args) throws Exception { jjg@38: new T6705935().run(); jjg@38: } jjg@38: jjg@38: public void run() throws Exception { jjg@38: File java_home = new File(System.getProperty("java.home")); jjg@38: if (java_home.getName().equals("jre")) jjg@38: java_home = java_home.getParentFile(); jjg@38: jjg@38: JavaCompiler c = ToolProvider.getSystemJavaCompiler(); jjg@38: JavaFileManager fm = c.getStandardFileManager(null, null, null); jjg@38: for (JavaFileObject fo: fm.list(StandardLocation.PLATFORM_CLASS_PATH, jjg@38: "java.lang", jjg@38: Collections.singleton(JavaFileObject.Kind.CLASS), jjg@38: false)) { jjg@38: String p = ((BaseFileObject)fo).getPath(); jjg@38: int bra = p.indexOf("("); jjg@38: int ket = p.indexOf(")"); jjg@38: //System.err.println(bra + "," + ket + "," + p.length()); jjg@38: if (bra == -1 || ket != p.length() -1) jjg@38: throw new Exception("unexpected path: " + p + "[" + bra + "," + ket + "," + p.length()); jjg@38: String part1 = p.substring(0, bra); jjg@38: String part2 = p.substring(bra + 1, ket); jjg@38: //System.err.println("[" + part1 + "|" + part2 + "]" + " " + java_home); jjg@38: if (part1.equals(part2) || !part1.startsWith(java_home.getPath())) jjg@38: throw new Exception("bad path: " + p); jjg@38: jjg@38: } jjg@38: } jjg@38: }