author | ohair |
Wed, 06 Apr 2011 22:06:11 -0700 | |
changeset 9035 | 1255eb81cc2f |
parent 8184 | 526b9179a2bb |
permissions | -rw-r--r-- |
2057
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
1 |
/* |
9035
1255eb81cc2f
7033660: Update copyright year to 2011 on any files changed in 2011
ohair
parents:
8184
diff
changeset
|
2 |
* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. |
2057
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
4 |
* |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
8 |
* |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
13 |
* accompanied this code). |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
14 |
* |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
18 |
* |
5506 | 19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
2057
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
22 |
*/ |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
23 |
|
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
24 |
/* @test |
8184
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
25 |
* @bug 4313887 7003155 |
2057
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
26 |
* @summary Unit test for java.nio.file.Path |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
27 |
*/ |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
28 |
|
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
29 |
import java.nio.file.*; |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
30 |
import java.net.URI; |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
31 |
import java.net.URISyntaxException; |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
32 |
import java.io.PrintStream; |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
33 |
|
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
34 |
public class UriImportExport { |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
35 |
|
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
36 |
static final PrintStream log = System.out; |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
37 |
static int failures = 0; |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
38 |
|
8184
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
39 |
/** |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
40 |
* Test Path -> URI -> Path |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
41 |
*/ |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
42 |
static void testPath(String s) { |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
43 |
Path path = Paths.get(s); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
44 |
log.println(path); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
45 |
URI uri = path.toUri(); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
46 |
log.println(" --> " + uri); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
47 |
Path result = Paths.get(uri); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
48 |
log.println(" --> " + result); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
49 |
if (!result.equals(path.toAbsolutePath())) { |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
50 |
log.println("FAIL: Expected " + path + ", got " + result); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
51 |
failures++; |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
52 |
} |
2057
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
53 |
log.println(); |
8184
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
54 |
} |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
55 |
|
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
56 |
/** |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
57 |
* Test Path -> (expected) URI -> Path |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
58 |
*/ |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
59 |
static void testPath(String s, String expectedUri) { |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
60 |
Path path = Paths.get(s); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
61 |
log.println(path); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
62 |
URI uri = path.toUri(); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
63 |
log.println(" --> " + uri); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
64 |
if (!uri.toString().equals(expectedUri)) { |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
65 |
log.println("FAILED: Expected " + expectedUri + ", got " + uri); |
2057
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
66 |
failures++; |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
67 |
return; |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
68 |
} |
8184
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
69 |
Path result = Paths.get(uri); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
70 |
log.println(" --> " + result); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
71 |
if (!result.equals(path.toAbsolutePath())) { |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
72 |
log.println("FAIL: Expected " + path + ", got " + result); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
73 |
failures++; |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
74 |
} |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
75 |
log.println(); |
2057
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
76 |
} |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
77 |
|
8184
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
78 |
/** |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
79 |
* Test URI -> Path -> URI |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
80 |
*/ |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
81 |
static void testUri(String s) throws Exception { |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
82 |
URI uri = URI.create(s); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
83 |
log.println(uri); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
84 |
Path path = Paths.get(uri); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
85 |
log.println(" --> " + path); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
86 |
URI result = path.toUri(); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
87 |
log.println(" --> " + result); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
88 |
if (!result.equals(uri)) { |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
89 |
log.println("FAIL: Expected " + uri + ", got " + result); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
90 |
failures++; |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
91 |
} |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
92 |
log.println(); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
93 |
} |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
94 |
|
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
95 |
/** |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
96 |
* Test URI -> Path fails with IllegalArgumentException |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
97 |
*/ |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
98 |
static void testBadUri(String s) throws Exception { |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
99 |
URI uri = URI.create(s); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
100 |
log.println(uri); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
101 |
try { |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
102 |
Path path = Paths.get(uri); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
103 |
log.format(" --> %s FAIL: Expected IllegalArgumentException\n", path); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
104 |
failures++; |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
105 |
} catch (IllegalArgumentException expected) { |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
106 |
log.println(" --> IllegalArgumentException (expected)"); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
107 |
} |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
108 |
log.println(); |
2057
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
109 |
} |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
110 |
|
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
111 |
public static void main(String[] args) throws Exception { |
8184
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
112 |
testBadUri("file:foo"); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
113 |
testBadUri("file:/foo?q"); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
114 |
testBadUri("file:/foo#f"); |
2057
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
115 |
|
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
116 |
String osname = System.getProperty("os.name"); |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
117 |
if (osname.startsWith("Windows")) { |
8184
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
118 |
testPath("C:\\doesnotexist"); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
119 |
testPath("C:doesnotexist"); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
120 |
testPath("\\\\server.nowhere.oracle.com\\share\\"); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
121 |
testPath("\\\\fe80--203-baff-fe5a-749ds1.ipv6-literal.net\\share\\missing", |
2057
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
122 |
"file://[fe80::203:baff:fe5a:749d%1]/share/missing"); |
8184
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
123 |
} else { |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
124 |
testPath("doesnotexist"); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
125 |
testPath("/doesnotexist"); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
126 |
testPath("/does not exist"); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
127 |
testUri("file:///"); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
128 |
testUri("file:///foo/bar/doesnotexist"); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
129 |
testUri("file:/foo/bar/doesnotexist"); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
130 |
|
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
131 |
// file:///foo/bar/\u0440\u0443\u0441\u0441\u043A\u0438\u0439 (Russian) |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
132 |
testUri("file:///foo/bar/%D1%80%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9"); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
133 |
|
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
134 |
// invalid |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
135 |
testBadUri("file:foo"); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
136 |
testBadUri("file://server/foo"); |
526b9179a2bb
7003155: (fs) Paths.get(<file-uri>) does not handle escaped octets correctly
alanb
parents:
5506
diff
changeset
|
137 |
testBadUri("file:///foo%00"); |
2057
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
138 |
} |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
139 |
|
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
140 |
if (failures > 0) |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
141 |
throw new RuntimeException(failures + " test(s) failed"); |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
142 |
} |
3acf8e5e2ca0
6781363: New I/O: Update socket-channel API to jsr203/nio2-b99
alanb
parents:
diff
changeset
|
143 |
} |