2
|
1 |
/*
|
5506
|
2 |
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
|
2
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
|
7 |
* published by the Free Software Foundation.
|
|
8 |
*
|
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
13 |
* accompanied this code).
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License version
|
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
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.
|
2
|
22 |
*/
|
|
23 |
|
|
24 |
/*
|
|
25 |
*******************************************************************************
|
|
26 |
* Copyright (C) 2003-2004, International Business Machines Corporation and *
|
|
27 |
* others. All Rights Reserved. *
|
|
28 |
*******************************************************************************
|
|
29 |
*/
|
|
30 |
import java.text.ParseException;
|
|
31 |
|
|
32 |
/**
|
|
33 |
* @author ram
|
|
34 |
*
|
|
35 |
* To change the template for this generated type comment go to
|
|
36 |
* Window>Preferences>Java>Code Generation>Code and Comments
|
|
37 |
*/
|
|
38 |
public class TestData {
|
|
39 |
public static final char[][] unicodeIn ={
|
|
40 |
{
|
|
41 |
0x0644, 0x064A, 0x0647, 0x0645, 0x0627, 0x0628, 0x062A, 0x0643, 0x0644,
|
|
42 |
0x0645, 0x0648, 0x0634, 0x0639, 0x0631, 0x0628, 0x064A, 0x061F
|
|
43 |
},
|
|
44 |
{
|
|
45 |
0x4ED6, 0x4EEC, 0x4E3A, 0x4EC0, 0x4E48, 0x4E0D, 0x8BF4, 0x4E2D, 0x6587,
|
|
46 |
|
|
47 |
},
|
|
48 |
{
|
|
49 |
0x0050, 0x0072, 0x006F, 0x010D, 0x0070, 0x0072, 0x006F, 0x0073, 0x0074,
|
|
50 |
0x011B, 0x006E, 0x0065, 0x006D, 0x006C, 0x0075, 0x0076, 0x00ED, 0x010D,
|
|
51 |
0x0065, 0x0073, 0x006B, 0x0079,
|
|
52 |
},
|
|
53 |
{
|
|
54 |
0x05DC, 0x05DE, 0x05D4, 0x05D4, 0x05DD, 0x05E4, 0x05E9, 0x05D5, 0x05D8,
|
|
55 |
0x05DC, 0x05D0, 0x05DE, 0x05D3, 0x05D1, 0x05E8, 0x05D9, 0x05DD, 0x05E2,
|
|
56 |
0x05D1, 0x05E8, 0x05D9, 0x05EA,
|
|
57 |
},
|
|
58 |
{
|
|
59 |
0x092F, 0x0939, 0x0932, 0x094B, 0x0917, 0x0939, 0x093F, 0x0928, 0x094D,
|
|
60 |
0x0926, 0x0940, 0x0915, 0x094D, 0x092F, 0x094B, 0x0902, 0x0928, 0x0939,
|
|
61 |
0x0940, 0x0902, 0x092C, 0x094B, 0x0932, 0x0938, 0x0915, 0x0924, 0x0947,
|
|
62 |
0x0939, 0x0948, 0x0902,
|
|
63 |
},
|
|
64 |
{
|
|
65 |
0x306A, 0x305C, 0x307F, 0x3093, 0x306A, 0x65E5, 0x672C, 0x8A9E, 0x3092,
|
|
66 |
0x8A71, 0x3057, 0x3066, 0x304F, 0x308C, 0x306A, 0x3044, 0x306E, 0x304B,
|
|
67 |
|
|
68 |
},
|
|
69 |
/*
|
|
70 |
{
|
|
71 |
0xC138, 0xACC4, 0xC758, 0xBAA8, 0xB4E0, 0xC0AC, 0xB78C, 0xB4E4, 0xC774,
|
|
72 |
0xD55C, 0xAD6D, 0xC5B4, 0xB97C, 0xC774, 0xD574, 0xD55C, 0xB2E4, 0xBA74,
|
|
73 |
0xC5BC, 0xB9C8, 0xB098, 0xC88B, 0xC744, 0xAE4C,
|
|
74 |
},
|
|
75 |
*/
|
|
76 |
{
|
|
77 |
0x043F, 0x043E, 0x0447, 0x0435, 0x043C, 0x0443, 0x0436, 0x0435, 0x043E,
|
|
78 |
0x043D, 0x0438, 0x043D, 0x0435, 0x0433, 0x043E, 0x0432, 0x043E, 0x0440,
|
|
79 |
0x044F, 0x0442, 0x043F, 0x043E, 0x0440, 0x0443, 0x0441, 0x0441, 0x043A,
|
|
80 |
0x0438,
|
|
81 |
},
|
|
82 |
{
|
|
83 |
0x0050, 0x006F, 0x0072, 0x0071, 0x0075, 0x00E9, 0x006E, 0x006F, 0x0070,
|
|
84 |
0x0075, 0x0065, 0x0064, 0x0065, 0x006E, 0x0073, 0x0069, 0x006D, 0x0070,
|
|
85 |
0x006C, 0x0065, 0x006D, 0x0065, 0x006E, 0x0074, 0x0065, 0x0068, 0x0061,
|
|
86 |
0x0062, 0x006C, 0x0061, 0x0072, 0x0065, 0x006E, 0x0045, 0x0073, 0x0070,
|
|
87 |
0x0061, 0x00F1, 0x006F, 0x006C,
|
|
88 |
},
|
|
89 |
{
|
|
90 |
0x4ED6, 0x5011, 0x7232, 0x4EC0, 0x9EBD, 0x4E0D, 0x8AAA, 0x4E2D, 0x6587,
|
|
91 |
|
|
92 |
},
|
|
93 |
{
|
|
94 |
0x0054, 0x1EA1, 0x0069, 0x0073, 0x0061, 0x006F, 0x0068, 0x1ECD, 0x006B,
|
|
95 |
0x0068, 0x00F4, 0x006E, 0x0067, 0x0074, 0x0068, 0x1EC3, 0x0063, 0x0068,
|
|
96 |
0x1EC9, 0x006E, 0x00F3, 0x0069, 0x0074, 0x0069, 0x1EBF, 0x006E, 0x0067,
|
|
97 |
0x0056, 0x0069, 0x1EC7, 0x0074,
|
|
98 |
},
|
|
99 |
{
|
|
100 |
0x0033, 0x5E74, 0x0042, 0x7D44, 0x91D1, 0x516B, 0x5148, 0x751F,
|
|
101 |
},
|
|
102 |
{
|
|
103 |
0x5B89, 0x5BA4, 0x5948, 0x7F8E, 0x6075, 0x002D, 0x0077, 0x0069, 0x0074,
|
|
104 |
0x0068, 0x002D, 0x0053, 0x0055, 0x0050, 0x0045, 0x0052, 0x002D, 0x004D,
|
|
105 |
0x004F, 0x004E, 0x004B, 0x0045, 0x0059, 0x0053,
|
|
106 |
},
|
|
107 |
{
|
|
108 |
0x0048, 0x0065, 0x006C, 0x006C, 0x006F, 0x002D, 0x0041, 0x006E, 0x006F,
|
|
109 |
0x0074, 0x0068, 0x0065, 0x0072, 0x002D, 0x0057, 0x0061, 0x0079, 0x002D,
|
|
110 |
0x305D, 0x308C, 0x305E, 0x308C, 0x306E, 0x5834, 0x6240,
|
|
111 |
},
|
|
112 |
{
|
|
113 |
0x3072, 0x3068, 0x3064, 0x5C4B, 0x6839, 0x306E, 0x4E0B, 0x0032,
|
|
114 |
},
|
|
115 |
{
|
|
116 |
0x004D, 0x0061, 0x006A, 0x0069, 0x3067, 0x004B, 0x006F, 0x0069, 0x3059,
|
|
117 |
0x308B, 0x0035, 0x79D2, 0x524D,
|
|
118 |
},
|
|
119 |
{
|
|
120 |
0x30D1, 0x30D5, 0x30A3, 0x30FC, 0x0064, 0x0065, 0x30EB, 0x30F3, 0x30D0,
|
|
121 |
|
|
122 |
},
|
|
123 |
{
|
|
124 |
0x305D, 0x306E, 0x30B9, 0x30D4, 0x30FC, 0x30C9, 0x3067,
|
|
125 |
},
|
|
126 |
// test non-BMP code points
|
|
127 |
{
|
|
128 |
0xD800, 0xDF00, 0xD800, 0xDF01, 0xD800, 0xDF02, 0xD800, 0xDF03, 0xD800, 0xDF05,
|
|
129 |
0xD800, 0xDF06, 0xD800, 0xDF07, 0xD800, 0xDF09, 0xD800, 0xDF0A, 0xD800, 0xDF0B,
|
|
130 |
|
|
131 |
},
|
|
132 |
{
|
|
133 |
0xD800, 0xDF0D, 0xD800, 0xDF0C, 0xD800, 0xDF1E, 0xD800, 0xDF0F, 0xD800, 0xDF16,
|
|
134 |
0xD800, 0xDF15, 0xD800, 0xDF14, 0xD800, 0xDF12, 0xD800, 0xDF10, 0xD800, 0xDF20,
|
|
135 |
0xD800, 0xDF21,
|
|
136 |
|
|
137 |
},
|
|
138 |
// Greek
|
|
139 |
{
|
|
140 |
0x03b5, 0x03bb, 0x03bb, 0x03b7, 0x03bd, 0x03b9, 0x03ba, 0x03ac
|
|
141 |
},
|
|
142 |
// Maltese
|
|
143 |
{
|
|
144 |
0x0062, 0x006f, 0x006e, 0x0121, 0x0075, 0x0073, 0x0061, 0x0127,
|
|
145 |
0x0127, 0x0061
|
|
146 |
},
|
|
147 |
// Russian
|
|
148 |
{
|
|
149 |
0x043f, 0x043e, 0x0447, 0x0435, 0x043c, 0x0443, 0x0436, 0x0435,
|
|
150 |
0x043e, 0x043d, 0x0438, 0x043d, 0x0435, 0x0433, 0x043e, 0x0432,
|
|
151 |
0x043e, 0x0440, 0x044f, 0x0442, 0x043f, 0x043e, 0x0440, 0x0443,
|
|
152 |
0x0441, 0x0441, 0x043a, 0x0438
|
|
153 |
},
|
|
154 |
|
|
155 |
};
|
|
156 |
|
|
157 |
public static final String[] asciiIn = {
|
|
158 |
"xn--egbpdaj6bu4bxfgehfvwxn",
|
|
159 |
"xn--ihqwcrb4cv8a8dqg056pqjye",
|
|
160 |
"xn--Proprostnemluvesky-uyb24dma41a",
|
|
161 |
"xn--4dbcagdahymbxekheh6e0a7fei0b",
|
|
162 |
"xn--i1baa7eci9glrd9b2ae1bj0hfcgg6iyaf8o0a1dig0cd",
|
|
163 |
"xn--n8jok5ay5dzabd5bym9f0cm5685rrjetr6pdxa",
|
|
164 |
/* "xn--989aomsvi5e83db1d2a355cv1e0vak1dwrv93d5xbh15a0dt30a5jpsd879ccm6fea98c",*/
|
|
165 |
"xn--b1abfaaepdrnnbgefbaDotcwatmq2g4l",
|
|
166 |
"xn--PorqunopuedensimplementehablarenEspaol-fmd56a",
|
|
167 |
"xn--ihqwctvzc91f659drss3x8bo0yb",
|
|
168 |
"xn--TisaohkhngthchnitingVit-kjcr8268qyxafd2f1b9g",
|
|
169 |
"xn--3B-ww4c5e180e575a65lsy2b",
|
|
170 |
"xn---with-SUPER-MONKEYS-pc58ag80a8qai00g7n9n",
|
|
171 |
"xn--Hello-Another-Way--fc4qua05auwb3674vfr0b",
|
|
172 |
"xn--2-u9tlzr9756bt3uc0v",
|
|
173 |
"xn--MajiKoi5-783gue6qz075azm5e",
|
|
174 |
"xn--de-jg4avhby1noc0d",
|
|
175 |
"xn--d9juau41awczczp",
|
|
176 |
"XN--097CCDEKGHQJK",
|
|
177 |
"XN--db8CBHEJLGH4E0AL",
|
|
178 |
"xn--hxargifdar", // Greek
|
|
179 |
"xn--bonusaa-5bb1da", // Maltese
|
|
180 |
"xn--b1abfaaepdrnnbgefbadotcwatmq2g4l", // Russian (Cyrillic)
|
|
181 |
};
|
|
182 |
|
|
183 |
public static final String[] domainNames = {
|
|
184 |
"slip129-37-118-146.nc.us.ibm.net",
|
|
185 |
"saratoga.pe.utexas.edu",
|
|
186 |
"dial-120-45.ots.utexas.edu",
|
|
187 |
"woo-085.dorms.waller.net",
|
|
188 |
"hd30-049.hil.compuserve.com",
|
|
189 |
"pem203-31.pe.ttu.edu",
|
|
190 |
"56K-227.MaxTNT3.pdq.net",
|
|
191 |
"dial-36-2.ots.utexas.edu",
|
|
192 |
"slip129-37-23-152.ga.us.ibm.net",
|
|
193 |
"ts45ip119.cadvision.com",
|
|
194 |
"sdn-ts-004txaustP05.dialsprint.net",
|
|
195 |
"bar-tnt1s66.erols.com",
|
|
196 |
"101.st-louis-15.mo.dial-access.att.net",
|
|
197 |
"h92-245.Arco.COM",
|
|
198 |
"dial-13-2.ots.utexas.edu",
|
|
199 |
"net-redynet29.datamarkets.com.ar",
|
|
200 |
"ccs-shiva28.reacciun.net.ve",
|
|
201 |
"7.houston-11.tx.dial-access.att.net",
|
|
202 |
"ingw129-37-120-26.mo.us.ibm.net",
|
|
203 |
"dialup6.austintx.com",
|
|
204 |
"dns2.tpao.gov.tr",
|
|
205 |
"slip129-37-119-194.nc.us.ibm.net",
|
|
206 |
"cs7.dillons.co.uk.203.119.193.in-addr.arpa",
|
|
207 |
"swprd1.innovplace.saskatoon.sk.ca",
|
|
208 |
"bikini.bologna.maraut.it",
|
|
209 |
"node91.subnet159-198-79.baxter.com",
|
|
210 |
"cust19.max5.new-york.ny.ms.uu.net",
|
|
211 |
"balexander.slip.andrew.cmu.edu",
|
|
212 |
"pool029.max2.denver.co.dynip.alter.net",
|
|
213 |
"cust49.max9.new-york.ny.ms.uu.net",
|
|
214 |
"s61.abq-dialin2.hollyberry.com",
|
|
215 |
|
|
216 |
};
|
|
217 |
|
|
218 |
public static final String[] domainNames1Uni = {
|
|
219 |
"\u0917\u0928\u0947\u0936.sanjose.ibm.com",
|
|
220 |
"www.\u0121.com",
|
|
221 |
//"www.\u00E0\u00B3\u00AF.com",
|
|
222 |
"www.\u00C2\u00A4.com",
|
|
223 |
"www.\u00C2\u00A3.com",
|
|
224 |
// "\\u0025", //'%' (0x0025) produces U_IDNA_STD3_ASCII_RULES_ERROR
|
|
225 |
// "\\u005C\\u005C", //'\' (0x005C) produces U_IDNA_STD3_ASCII_RULES_ERROR
|
|
226 |
//"@",
|
|
227 |
//"\\u002F",
|
|
228 |
//"www.\\u0021.com",
|
|
229 |
//"www.\\u0024.com",
|
|
230 |
//"\\u003f",
|
|
231 |
// These yeild U_IDNA_PROHIBITED_ERROR
|
|
232 |
//"\\u00CF\\u0082.com",
|
|
233 |
//"\\u00CE\\u00B2\\u00C3\\u009Fss.com",
|
|
234 |
//"\\u00E2\\u0098\\u00BA.com",
|
|
235 |
"\u00C3\u00BC.com"
|
|
236 |
};
|
|
237 |
public static final String[] domainNamesToASCIIOut = {
|
|
238 |
"xn--31b8a2bwd.sanjose.ibm.com",
|
|
239 |
"www.xn--vea.com",
|
|
240 |
//"www.xn--3 -iia80t.com",
|
|
241 |
"www.xn--bba7j.com",
|
|
242 |
"www.xn--9a9j.com",
|
|
243 |
// "\u0025",
|
|
244 |
// "\u005C\u005C",
|
|
245 |
// "@",
|
|
246 |
// "\u002F",
|
|
247 |
// "www.\u0021.com",
|
|
248 |
// "www.\u0024.com",
|
|
249 |
// "\u003f",
|
|
250 |
"xn--14-ria7423a.com"
|
|
251 |
|
|
252 |
};
|
|
253 |
|
|
254 |
public static final String[] domainNamesToUnicodeOut = {
|
|
255 |
"\u0917\u0928\u0947\u0936.sanjose.ibm.com",
|
|
256 |
"www.\u0121.com",
|
|
257 |
//"www.\u00E0\u0033\u0020\u0304.com",
|
|
258 |
"www.\u00E2\u00A4.com",
|
|
259 |
"www.\u00E2\u00A3.com",
|
|
260 |
// "\u0025",
|
|
261 |
// "\u005C\u005C",
|
|
262 |
// "@",
|
|
263 |
// "\u002F",
|
|
264 |
// "www.\u0021.com",
|
|
265 |
// "www.\u0024.com",
|
|
266 |
// "\u003f",
|
|
267 |
"\u00E3\u0031\u2044\u0034.com"
|
|
268 |
|
|
269 |
};
|
|
270 |
|
|
271 |
|
|
272 |
public static class ErrorCase{
|
|
273 |
|
|
274 |
public char[] unicode;
|
|
275 |
public String ascii;
|
|
276 |
public Exception expected;
|
|
277 |
public boolean useSTD3ASCIIRules;
|
|
278 |
public boolean testToUnicode;
|
|
279 |
public boolean testLabel;
|
|
280 |
ErrorCase(char[] uniIn, String asciiIn, Exception ex,
|
|
281 |
boolean std3, boolean testToUni, boolean testlabel){
|
|
282 |
unicode = uniIn;
|
|
283 |
ascii = asciiIn;
|
|
284 |
expected = ex;
|
|
285 |
useSTD3ASCIIRules = std3;
|
|
286 |
testToUnicode = testToUni;
|
|
287 |
testLabel = testlabel;
|
|
288 |
|
|
289 |
}
|
|
290 |
};
|
|
291 |
public static final ErrorCase[] errorCases = {
|
|
292 |
|
|
293 |
|
|
294 |
new ErrorCase( new char[]{
|
|
295 |
0x0077, 0x0077, 0x0077, 0x002e, /* www. */
|
|
296 |
0xC138, 0xACC4, 0xC758, 0xBAA8, 0xB4E0, 0xC0AC, 0xB78C, 0xB4E4, 0xC774,
|
|
297 |
0x070F,/*prohibited*/
|
|
298 |
0xD55C, 0xAD6D, 0xC5B4, 0xB97C, 0xC774, 0xD574, 0xD55C, 0xB2E4, 0xBA74,
|
|
299 |
0x002e, 0x0063, 0x006f, 0x006d, /* com. */
|
|
300 |
|
|
301 |
},
|
|
302 |
"www.XN--8mb5595fsoa28orucya378bqre2tcwop06c5qbw82a1rffmae0361dea96b.com",
|
|
303 |
new ParseException("StringPrep PROHIBITED_ERROR", -1),
|
|
304 |
false, true, true),
|
|
305 |
|
|
306 |
new ErrorCase( new char[]{
|
|
307 |
0x0077, 0x0077, 0x0077, 0x002e, /* www. */
|
|
308 |
0xC138, 0xACC4, 0xC758, 0xBAA8, 0xB4E0, 0xC0AC, 0xB78C, 0xB4E4, 0xC774,
|
|
309 |
0x0221, 0x0234/*Unassigned code points*/,
|
|
310 |
0x002e, 0x0063, 0x006f, 0x006d, /* com. */
|
|
311 |
|
|
312 |
},
|
|
313 |
"www.XN--6lA2Bz548Fj1GuA391Bf1Gb1N59Ab29A7iA.com",
|
|
314 |
|
|
315 |
new ParseException("StringPrep UNASSIGNED_ERROR", -1),
|
|
316 |
false, true, true
|
|
317 |
),
|
|
318 |
new ErrorCase( new char[]{
|
|
319 |
0x0077, 0x0077, 0x0077, 0x002e, /* www. */
|
|
320 |
0xC138, 0xACC4, 0xC758, 0xBAA8, 0xB4E0, 0xC0AC, 0xB78C, 0xB4E4, 0xC774,
|
|
321 |
0x0644, 0x064A, 0x0647,/*Arabic code points. Cannot mix RTL with LTR*/
|
|
322 |
0xD55C, 0xAD6D, 0xC5B4, 0xB97C, 0xC774, 0xD574, 0xD55C, 0xB2E4, 0xBA74,
|
|
323 |
0x002e, 0x0063, 0x006f, 0x006d, /* com. */
|
|
324 |
|
|
325 |
},
|
|
326 |
"www.xn--ghBGI4851OiyA33VqrD6Az86C4qF83CtRv93D5xBk15AzfG0nAgA0578DeA71C.com",
|
|
327 |
new ParseException("StringPrep CHECK_BIDI_ERROR", -1),
|
|
328 |
false, true, true
|
|
329 |
),
|
|
330 |
new ErrorCase( new char[]{
|
|
331 |
0x0077, 0x0077, 0x0077, 0x002e, /* www. */
|
|
332 |
/* labels cannot begin with an HYPHEN */
|
|
333 |
0x002D, 0xACC4, 0xC758, 0xBAA8, 0xB4E0, 0xC0AC, 0xB78C, 0xB4E4, 0xC774,
|
|
334 |
0x002E,
|
|
335 |
0xD55C, 0xAD6D, 0xC5B4, 0xB97C, 0xC774, 0xD574, 0xD55C, 0xB2E4, 0xBA74,
|
|
336 |
0x002e, 0x0063, 0x006f, 0x006d, /* com. */
|
|
337 |
|
|
338 |
|
|
339 |
},
|
|
340 |
"www.xn----b95Ew8SqA315Ao5FbuMlnNmhA.com",
|
|
341 |
new ParseException("StringPrep STD3_ASCII_RULES_ERROR", -1),
|
|
342 |
true, true, false
|
|
343 |
),
|
|
344 |
new ErrorCase( new char[]{
|
|
345 |
/* correct ACE-prefix followed by unicode */
|
|
346 |
0x0077, 0x0077, 0x0077, 0x002e, /* www. */
|
|
347 |
0x0078, 0x006e, 0x002d,0x002d, /* ACE Prefix */
|
|
348 |
0x002D, 0xACC4, 0xC758, 0xBAA8, 0xB4E0, 0xC0AC, 0xB78C, 0xB4E4, 0xC774,
|
|
349 |
0x002D,
|
|
350 |
0xD55C, 0xAD6D, 0xC5B4, 0xB97C, 0xC774, 0xD574, 0xD55C, 0xB2E4, 0xBA74,
|
|
351 |
0x002e, 0x0063, 0x006f, 0x006d, /* com. */
|
|
352 |
|
|
353 |
|
|
354 |
},
|
|
355 |
/* wrong ACE-prefix followed by valid ACE-encoded ASCII */
|
|
356 |
"www.XY-----b91I0V65S96C2A355Cw1E5yCeQr19CsnP1mFfmAE0361DeA96B.com",
|
|
357 |
new ParseException("StringPrep ACE_PREFIX_ERROR", -1),
|
|
358 |
false, false, false
|
|
359 |
),
|
|
360 |
/* cannot verify U_IDNA_VERIFICATION_ERROR */
|
|
361 |
|
|
362 |
new ErrorCase( new char[]{
|
|
363 |
0x0077, 0x0077, 0x0077, 0x002e, /* www. */
|
|
364 |
0xC138, 0xACC4, 0xC758, 0xBAA8, 0xB4E0, 0xC0AC, 0xB78C, 0xB4E4, 0xC774,
|
|
365 |
0xD55C, 0xAD6D, 0xC5B4, 0xB97C, 0xC774, 0xD574, 0xD55C, 0xB2E4, 0xBA74,
|
|
366 |
0xC5BC, 0xB9C8, 0xB098, 0xC88B, 0xC744, 0xAE4C,
|
|
367 |
0x002e, 0x0063, 0x006f, 0x006d, /* com. */
|
|
368 |
|
|
369 |
},
|
|
370 |
"www.xn--989AoMsVi5E83Db1D2A355Cv1E0vAk1DwRv93D5xBh15A0Dt30A5JpSD879Ccm6FeA98C.com",
|
|
371 |
new ParseException("StringPrep LABEL_TOO_LONG_ERROR", -1),
|
|
372 |
false, true, true
|
|
373 |
),
|
|
374 |
new ErrorCase( new char[]{
|
|
375 |
0x0077, 0x0077, 0x0077, 0x002e, /* www. */
|
|
376 |
0x0030, 0x0644, 0x064A, 0x0647, 0x0031, /* Arabic code points squashed between EN codepoints */
|
|
377 |
0x002e, 0x0063, 0x006f, 0x006d, /* com. */
|
|
378 |
|
|
379 |
},
|
|
380 |
"www.xn--01-tvdmo.com",
|
|
381 |
new ParseException("StringPrep CHECK_BIDI_ERROR", -1),
|
|
382 |
false, true, true
|
|
383 |
),
|
|
384 |
|
|
385 |
new ErrorCase( new char[]{
|
|
386 |
0x0077, 0x0077, 0x0077, 0x002e, // www.
|
|
387 |
0x206C, 0x0644, 0x064A, 0x0647, 0x206D, // Arabic code points squashed between BN codepoints
|
|
388 |
0x002e, 0x0063, 0x006f, 0x006d, // com.
|
|
389 |
|
|
390 |
},
|
|
391 |
"www.XN--ghbgi278xia.com",
|
|
392 |
new ParseException("StringPrep PROHIBITED_ERROR", -1),
|
|
393 |
false, true, true
|
|
394 |
),
|
|
395 |
new ErrorCase( new char[] {
|
|
396 |
0x0077, 0x0077, 0x0077, 0x002e, // www.
|
|
397 |
0x002D, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, // HYPHEN at the start of label
|
|
398 |
0x002e, 0x0063, 0x006f, 0x006d, // com.
|
|
399 |
|
|
400 |
},
|
|
401 |
"www.-abcde.com",
|
|
402 |
new ParseException("StringPrep STD3_ASCII_RULES_ERROR", -1),
|
|
403 |
true, true, false
|
|
404 |
),
|
|
405 |
new ErrorCase( new char[] {
|
|
406 |
0x0077, 0x0077, 0x0077, 0x002e, // www.
|
|
407 |
0x0041, 0x0042, 0x0043, 0x0044, 0x0045,0x002D, // HYPHEN at the end of the label
|
|
408 |
0x002e, 0x0063, 0x006f, 0x006d, // com.
|
|
409 |
|
|
410 |
},
|
|
411 |
"www.abcde-.com",
|
|
412 |
new ParseException("StringPrep STD3_ASCII_RULES_ERROR", -1),
|
|
413 |
true, true, false
|
|
414 |
),
|
|
415 |
new ErrorCase( new char[]{
|
|
416 |
0x0077, 0x0077, 0x0077, 0x002e, // www.
|
|
417 |
0x0041, 0x0042, 0x0043, 0x0044, 0x0045,0x0040, // Containing non LDH code point
|
|
418 |
0x002e, 0x0063, 0x006f, 0x006d, // com.
|
|
419 |
|
|
420 |
},
|
|
421 |
"www.abcde@.com",
|
|
422 |
new ParseException("StringPrep STD3_ASCII_RULES_ERROR", -1),
|
|
423 |
true, true, false
|
|
424 |
),
|
|
425 |
|
|
426 |
};
|
|
427 |
|
|
428 |
|
|
429 |
public static final class ConformanceTestCase{
|
|
430 |
String comment;
|
|
431 |
String input;
|
|
432 |
String output;
|
|
433 |
String profile;
|
|
434 |
int flags;
|
|
435 |
Exception expected;
|
|
436 |
private static byte[] getBytes(String in){
|
|
437 |
if(in==null){
|
|
438 |
return null;
|
|
439 |
}
|
|
440 |
byte[] bytes = new byte[in.length()];
|
|
441 |
for(int i=0; i < in.length();i++){
|
|
442 |
bytes[i] = (byte)in.charAt(i);
|
|
443 |
}
|
|
444 |
return bytes;
|
|
445 |
}
|
|
446 |
ConformanceTestCase(String comt, String in, String out,
|
|
447 |
String prof, int flg, Exception ex)
|
|
448 |
{
|
|
449 |
|
|
450 |
try{
|
|
451 |
comment = comt;
|
|
452 |
byte[] bytes = getBytes(in);
|
|
453 |
input = new String(bytes,"UTF-8");
|
|
454 |
bytes = getBytes(out);
|
|
455 |
output = (bytes==null)? null : new String(bytes,"UTF-8");
|
|
456 |
profile = prof;
|
|
457 |
flags = flg;
|
|
458 |
expected = ex;
|
|
459 |
}catch (Exception e){
|
|
460 |
e.printStackTrace();
|
|
461 |
throw new RuntimeException();
|
|
462 |
}
|
|
463 |
}
|
|
464 |
}
|
|
465 |
|
|
466 |
public static final ConformanceTestCase[] conformanceTestCases =
|
|
467 |
{
|
|
468 |
|
|
469 |
new ConformanceTestCase(
|
|
470 |
"Case folding ASCII U+0043 U+0041 U+0046 U+0045",
|
|
471 |
"\u0043\u0041\u0046\u0045", "\u0063\u0061\u0066\u0065",
|
|
472 |
"Nameprep", 0,
|
|
473 |
null
|
|
474 |
|
|
475 |
),
|
|
476 |
new ConformanceTestCase(
|
|
477 |
"Case folding 8bit U+00DF (german sharp s)",
|
|
478 |
"\u00C3\u009F", "\u0073\u0073",
|
|
479 |
"Nameprep", 0,
|
|
480 |
null
|
|
481 |
),
|
|
482 |
new ConformanceTestCase(
|
|
483 |
"Non-ASCII multibyte space character U+1680",
|
|
484 |
"\u00E1\u009A\u0080", null,
|
|
485 |
"Nameprep", 0,
|
|
486 |
new ParseException("StringPrep PROHIBITED_ERROR", -1)
|
|
487 |
),
|
|
488 |
new ConformanceTestCase(
|
|
489 |
"Non-ASCII 8bit control character U+0085",
|
|
490 |
"\u00C2\u0085", null,
|
|
491 |
"Nameprep", 0,
|
|
492 |
new ParseException("StringPrep PROHIBITED_ERROR", -1)
|
|
493 |
),
|
|
494 |
new ConformanceTestCase(
|
|
495 |
"Non-ASCII multibyte control character U+180E",
|
|
496 |
"\u00E1\u00A0\u008E", null,
|
|
497 |
"Nameprep", 0,
|
|
498 |
new ParseException("StringPrep PROHIBITED_ERROR", -1)
|
|
499 |
),
|
|
500 |
new ConformanceTestCase(
|
|
501 |
"Non-ASCII control character U+1D175",
|
|
502 |
"\u00F0\u009D\u0085\u00B5", null,
|
|
503 |
"Nameprep", 0,
|
|
504 |
new ParseException("StringPrep PROHIBITED_ERROR", -1)
|
|
505 |
),
|
|
506 |
new ConformanceTestCase(
|
|
507 |
"Plane 0 private use character U+F123",
|
|
508 |
"\u00EF\u0084\u00A3", null,
|
|
509 |
"Nameprep", 0,
|
|
510 |
new ParseException("StringPrep PROHIBITED_ERROR", -1)
|
|
511 |
),
|
|
512 |
new ConformanceTestCase(
|
|
513 |
"Plane 15 private use character U+F1234",
|
|
514 |
"\u00F3\u00B1\u0088\u00B4", null,
|
|
515 |
"Nameprep", 0,
|
|
516 |
new ParseException("StringPrep PROHIBITED_ERROR", -1)
|
|
517 |
),
|
|
518 |
new ConformanceTestCase(
|
|
519 |
"Plane 16 private use character U+10F234",
|
|
520 |
"\u00F4\u008F\u0088\u00B4", null,
|
|
521 |
"Nameprep", 0,
|
|
522 |
new ParseException("StringPrep PROHIBITED_ERROR", -1)
|
|
523 |
),
|
|
524 |
new ConformanceTestCase(
|
|
525 |
"Non-character code point U+8FFFE",
|
|
526 |
"\u00F2\u008F\u00BF\u00BE", null,
|
|
527 |
"Nameprep", 0,
|
|
528 |
new ParseException("StringPrep PROHIBITED_ERROR", -1)
|
|
529 |
),
|
|
530 |
new ConformanceTestCase(
|
|
531 |
"Non-character code point U+10FFFF",
|
|
532 |
"\u00F4\u008F\u00BF\u00BF", null,
|
|
533 |
"Nameprep", 0,
|
|
534 |
new ParseException("StringPrep PROHIBITED_ERROR", -1)
|
|
535 |
),
|
|
536 |
/*
|
|
537 |
{
|
|
538 |
"Surrogate code U+DF42",
|
|
539 |
"\u00ED\u00BD\u0082", null, "Nameprep", InternationalizedDomainNames.DEFAULT,
|
|
540 |
U_IDNA_PROHIBITED_ERROR
|
|
541 |
},
|
|
542 |
*/
|
|
543 |
new ConformanceTestCase(
|
|
544 |
"Non-plain text character U+FFFD",
|
|
545 |
"\u00EF\u00BF\u00BD", null,
|
|
546 |
"Nameprep", 0,
|
|
547 |
new ParseException("StringPrep PROHIBITED_ERROR", -1)
|
|
548 |
),
|
|
549 |
new ConformanceTestCase(
|
|
550 |
"Ideographic description character U+2FF5",
|
|
551 |
"\u00E2\u00BF\u00B5", null,
|
|
552 |
"Nameprep", 0,
|
|
553 |
new ParseException("StringPrep PROHIBITED_ERROR", -1)
|
|
554 |
),
|
|
555 |
new ConformanceTestCase(
|
|
556 |
"Display property character U+0341",
|
|
557 |
"\u00CD\u0081", "\u00CC\u0081",
|
|
558 |
"Nameprep", 0,
|
|
559 |
null
|
|
560 |
|
|
561 |
),
|
|
562 |
|
|
563 |
new ConformanceTestCase(
|
|
564 |
"Left-to-right mark U+200E",
|
|
565 |
"\u00E2\u0080\u008E", "\u00CC\u0081",
|
|
566 |
"Nameprep", 0,
|
|
567 |
new ParseException("StringPrep PROHIBITED_ERROR", -1)
|
|
568 |
),
|
|
569 |
new ConformanceTestCase(
|
|
570 |
|
|
571 |
"Deprecated U+202A",
|
|
572 |
"\u00E2\u0080\u00AA", "\u00CC\u0081",
|
|
573 |
"Nameprep", 0,
|
|
574 |
new ParseException("StringPrep PROHIBITED_ERROR", -1)
|
|
575 |
),
|
|
576 |
new ConformanceTestCase(
|
|
577 |
"Language tagging character U+E0001",
|
|
578 |
"\u00F3\u00A0\u0080\u0081", "\u00CC\u0081",
|
|
579 |
"Nameprep", 0,
|
|
580 |
new ParseException("StringPrep PROHIBITED_ERROR", -1)
|
|
581 |
),
|
|
582 |
new ConformanceTestCase(
|
|
583 |
"Language tagging character U+E0042",
|
|
584 |
"\u00F3\u00A0\u0081\u0082", null,
|
|
585 |
"Nameprep", 0,
|
|
586 |
new ParseException("StringPrep PROHIBITED_ERROR", -1)
|
|
587 |
),
|
|
588 |
new ConformanceTestCase(
|
|
589 |
"Bidi: RandALCat character U+05BE and LCat characters",
|
|
590 |
"\u0066\u006F\u006F\u00D6\u00BE\u0062\u0061\u0072", null,
|
|
591 |
"Nameprep", 0,
|
|
592 |
new ParseException("StringPrep CHECK_BIDI_ERROR", -1)
|
|
593 |
),
|
|
594 |
new ConformanceTestCase(
|
|
595 |
"Bidi: RandALCat character U+FD50 and LCat characters",
|
|
596 |
"\u0066\u006F\u006F\u00EF\u00B5\u0090\u0062\u0061\u0072", null,
|
|
597 |
"Nameprep",0 ,
|
|
598 |
new ParseException("StringPrep CHECK_BIDI_ERROR", -1)
|
|
599 |
),
|
|
600 |
new ConformanceTestCase(
|
|
601 |
"Bidi: RandALCat character U+FB38 and LCat characters",
|
|
602 |
"\u0066\u006F\u006F\u00EF\u00B9\u00B6\u0062\u0061\u0072", "\u0066\u006F\u006F \u00d9\u008e\u0062\u0061\u0072",
|
|
603 |
"Nameprep", 0,
|
|
604 |
null
|
|
605 |
),
|
|
606 |
new ConformanceTestCase(
|
|
607 |
"Bidi: RandALCat without trailing RandALCat U+0627 U+0031",
|
|
608 |
"\u00D8\u00A7\u0031", null,
|
|
609 |
"Nameprep", 0,
|
|
610 |
new ParseException("StringPrep CHECK_BIDI_ERROR", -1)
|
|
611 |
),
|
|
612 |
new ConformanceTestCase(
|
|
613 |
"Bidi: RandALCat character U+0627 U+0031 U+0628",
|
|
614 |
"\u00D8\u00A7\u0031\u00D8\u00A8", "\u00D8\u00A7\u0031\u00D8\u00A8",
|
|
615 |
"Nameprep", 0,
|
|
616 |
null
|
|
617 |
),
|
|
618 |
new ConformanceTestCase(
|
|
619 |
"Unassigned code point U+E0002",
|
|
620 |
"\u00F3\u00A0\u0080\u0082", null,
|
|
621 |
"Nameprep", 0,
|
|
622 |
new ParseException("StringPrep UNASSIGNED_ERROR", -1)
|
|
623 |
),
|
|
624 |
|
|
625 |
/* // Invalid UTF-8
|
|
626 |
{
|
|
627 |
"Larger test (shrinking)",
|
|
628 |
"X\u00C2\u00AD\u00C3\u00DF\u00C4\u00B0\u00E2\u0084\u00A1\u006a\u00cc\u008c\u00c2\u00a0\u00c2"
|
|
629 |
"\u00aa\u00ce\u00b0\u00e2\u0080\u0080", "xssi\u00cc\u0087""tel\u00c7\u00b0 a\u00ce\u00b0 ",
|
|
630 |
"Nameprep",
|
|
631 |
InternationalizedDomainNames.DEFAULT, U_ZERO_ERROR
|
|
632 |
},
|
|
633 |
{
|
|
634 |
|
|
635 |
"Larger test (expanding)",
|
|
636 |
"X\u00C3\u00DF\u00e3\u008c\u0096\u00C4\u00B0\u00E2\u0084\u00A1\u00E2\u0092\u009F\u00E3\u008c\u0080",
|
|
637 |
"xss\u00e3\u0082\u00ad\u00e3\u0083\u00ad\u00e3\u0083\u00a1\u00e3\u0083\u00bc\u00e3\u0083\u0088"
|
|
638 |
"\u00e3\u0083\u00ab""i\u00cc\u0087""tel\u0028""d\u0029\u00e3\u0082\u00a2\u00e3\u0083\u0091"
|
|
639 |
"\u00e3\u0083\u00bc\u00e3\u0083\u0088"
|
|
640 |
"Nameprep",
|
|
641 |
InternationalizedDomainNames.DEFAULT, U_ZERO_ERROR
|
|
642 |
},
|
|
643 |
*/
|
|
644 |
};
|
|
645 |
}
|