author | pgovereau |
Mon, 21 Apr 2014 17:57:47 -0400 | |
changeset 24222 | 244127f8dd79 |
child 26100 | bb7dd001d190 |
permissions | -rw-r--r-- |
24222
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
1 |
/* |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
2 |
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
4 |
* |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
8 |
* |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
13 |
* accompanied this code). |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
14 |
* |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
18 |
* |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
21 |
* questions. |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
22 |
*/ |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
23 |
|
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
24 |
/* |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
25 |
* @test |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
26 |
* @bug 8030046 |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
27 |
* @summary javac incorrectly handles absolute paths in manifest classpath |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
28 |
* @author govereau |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
29 |
* @library /tools/javac/lib |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
30 |
* @build ToolBox |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
31 |
* @run main AbsolutePathTest |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
32 |
*/ |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
33 |
|
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
34 |
import java.io.File; |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
35 |
|
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
36 |
public class AbsolutePathTest { |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
37 |
public static void main(String... cmdline) throws Exception { |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
38 |
// compile test.Test |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
39 |
ToolBox.JavaToolArgs args = new ToolBox.JavaToolArgs(); |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
40 |
args.appendArgs("-d", "."); // this is needed to get the classfiles in test |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
41 |
ToolBox.javac(args.setSources("package test; public class Test{}")); |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
42 |
|
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
43 |
// build test.jar containing test.Test |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
44 |
// we need the jars in a directory different from the working |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
45 |
// directory to trigger the bug. I will reuse test/ |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
46 |
ToolBox.jar("cf", "test/test.jar", "test/Test.class"); |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
47 |
|
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
48 |
// build second jar in test directory using |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
49 |
// an absolute path reference to the first jar |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
50 |
String path = new File("test/test.jar").getAbsolutePath(); |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
51 |
ToolBox.mkManifestWithClassPath(null, path); |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
52 |
ToolBox.jar("cfm", "test/test2.jar", "MANIFEST.MF"); |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
53 |
|
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
54 |
// this should not fail |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
55 |
args.appendArgs("-cp", "."); |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
56 |
ToolBox.javac(args.setSources("import test.Test; class Test2 {}")); |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
57 |
} |
244127f8dd79
8030046: javac incorrectly handles absolute paths in manifest classpath
pgovereau
parents:
diff
changeset
|
58 |
} |