Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/sun/text/resources/Collator/Bug4804273.java
41152 views
1
/*
2
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
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
*
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.
22
*/
23
24
/*
25
* @test
26
* @bug 4804273
27
* @modules jdk.localedata
28
* @summary updating collation tables for swedish
29
*/
30
31
import java.text.Collator;
32
import java.util.Arrays;
33
import java.util.Locale;
34
35
public class Bug4804273 {
36
37
/********************************************************
38
*********************************************************/
39
public static void main (String[] args) {
40
Locale reservedLocale = Locale.getDefault();
41
try {
42
int errors=0;
43
44
Locale loc = new Locale ("sv", "se"); // Swedish
45
46
Locale.setDefault (loc);
47
Collator col = Collator.getInstance ();
48
49
String[] data = {"A",
50
"Aa",
51
"Ae",
52
"B",
53
"Y",
54
"U\u0308", // U-umlaut
55
"Z",
56
"A\u030a", // A-ring
57
"A\u0308", // A-umlaut
58
"\u00c6", // AE ligature
59
"O\u0308", // O-umlaut
60
"a\u030b", // a-double-acute
61
"\u00d8", // O-stroke
62
"a",
63
"aa",
64
"ae",
65
"b",
66
"y",
67
"u\u0308", // u-umlaut
68
"z",
69
"A\u030b", // A-double-acute
70
"a\u030a", // a-ring
71
"a\u0308", // a-umlaut
72
"\u00e6", // ae ligature
73
"o\u0308", // o-umlaut
74
"\u00f8", // o-stroke
75
};
76
77
78
String[] sortedData = {"a",
79
"A",
80
"aa",
81
"Aa",
82
"ae",
83
"Ae",
84
"b",
85
"B",
86
"y",
87
"Y",
88
"u\u0308", // o-umlaut
89
"U\u0308", // o-umlaut
90
"z",
91
"Z",
92
"a\u030a", // a-ring
93
"A\u030a", // A-ring
94
"a\u0308", // a-umlaut
95
"A\u0308", // A-umlaut
96
"a\u030b", // a-double-acute
97
"A\u030b", // A-double-acute
98
"\u00e6", // ae ligature
99
"\u00c6", // AE ligature
100
"o\u0308", // o-umlaut
101
"O\u0308", // O-umlaut
102
"\u00f8", // o-stroke
103
"\u00d8", // O-stroke
104
};
105
106
Arrays.sort (data, col);
107
108
System.out.println ("Using " + loc.getDisplayName());
109
for (int i = 0; i < data.length; i++) {
110
System.out.println(data[i] + " : " + sortedData[i]);
111
if (sortedData[i].compareTo(data[i]) != 0) {
112
errors++;
113
}
114
}//end for
115
116
if (errors > 0)
117
throw new RuntimeException("There are " + errors +
118
" words sorted incorrectly!");
119
} finally {
120
// restore the reserved locale
121
Locale.setDefault(reservedLocale);
122
}
123
}//end main
124
125
}//end class CollatorTest
126
127