author | ascarpino |
Fri, 12 May 2017 08:20:11 -0700 | |
changeset 45992 | 38bdf44057b9 |
parent 30730 | d3ce7619db2c |
permissions | -rw-r--r-- |
14061
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
1 |
/* |
30730
d3ce7619db2c
8076543: Add @modules as needed to the langtools tests
akulyakh
parents:
14061
diff
changeset
|
2 |
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. |
14061
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
4 |
* |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
8 |
* |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
13 |
* accompanied this code). |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
14 |
* |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
18 |
* |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
21 |
* questions. |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
22 |
*/ |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
23 |
|
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
24 |
import com.sun.tools.doclets.internal.toolkit.Configuration; |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
25 |
|
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
26 |
/** |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
27 |
* @test |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
28 |
* @bug 4696488 |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
29 |
* @summary javadoc doesn't handle UNC paths for destination directory |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
30 |
* @author Jesse Glick |
30730
d3ce7619db2c
8076543: Add @modules as needed to the langtools tests
akulyakh
parents:
14061
diff
changeset
|
31 |
* @modules jdk.javadoc/com.sun.tools.doclets.internal.toolkit |
14061
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
32 |
* @run main T4696488 T4696488.java |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
33 |
*/ |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
34 |
public class T4696488 { |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
35 |
|
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
36 |
public static void main(String... args) { |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
37 |
System.setProperty("file.separator", "/"); |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
38 |
assertAddTrailingFileSep("/path/to/dir", "/path/to/dir/"); |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
39 |
assertAddTrailingFileSep("/path/to/dir/", "/path/to/dir/"); |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
40 |
assertAddTrailingFileSep("/path/to/dir//", "/path/to/dir/"); |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
41 |
System.setProperty("file.separator", "\\"); |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
42 |
assertAddTrailingFileSep("C:\\path\\to\\dir", "C:\\path\\to\\dir\\"); |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
43 |
assertAddTrailingFileSep("C:\\path\\to\\dir\\", "C:\\path\\to\\dir\\"); |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
44 |
assertAddTrailingFileSep("C:\\path\\to\\dir\\\\", "C:\\path\\to\\dir\\"); |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
45 |
assertAddTrailingFileSep("\\\\server\\share\\path\\to\\dir", "\\\\server\\share\\path\\to\\dir\\"); |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
46 |
assertAddTrailingFileSep("\\\\server\\share\\path\\to\\dir\\", "\\\\server\\share\\path\\to\\dir\\"); |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
47 |
assertAddTrailingFileSep("\\\\server\\share\\path\\to\\dir\\\\", "\\\\server\\share\\path\\to\\dir\\"); |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
48 |
} |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
49 |
|
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
50 |
private static void assertAddTrailingFileSep(String input, String expectedOutput) { |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
51 |
String output = Configuration.addTrailingFileSep(input); |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
52 |
if (!expectedOutput.equals(output)) { |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
53 |
throw new Error("expected " + expectedOutput + " but was " + output); |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
54 |
} |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
55 |
} |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
56 |
|
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
diff
changeset
|
57 |
} |