author | naoto |
Wed, 15 May 2013 16:48:54 -0700 | |
changeset 17476 | 6a5362307fc3 |
parent 17440 | fb37aa6b305e |
child 17944 | bbd67fc49daa |
permissions | -rw-r--r-- |
13583 | 1 |
/* |
17169
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
14336
diff
changeset
|
2 |
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. |
13583 | 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 |
*/ |
|
14028
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
23 |
import java.text.*; |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
24 |
import java.text.spi.*; |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
25 |
import java.util.*; |
17169
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
14336
diff
changeset
|
26 |
import java.util.spi.*; |
13583 | 27 |
import sun.util.locale.provider.LocaleProviderAdapter; |
28 |
||
29 |
public class LocaleProviders { |
|
30 |
||
31 |
public static void main(String[] args) { |
|
14028
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
32 |
String methodName = args[0]; |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
33 |
|
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
34 |
switch (methodName) { |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
35 |
case "getPlatformLocale": |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
36 |
if (args[1].equals("format")) { |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
37 |
getPlatformLocale(Locale.Category.FORMAT); |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
38 |
} else { |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
39 |
getPlatformLocale(Locale.Category.DISPLAY); |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
40 |
} |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
41 |
break; |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
42 |
|
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
43 |
case "adapterTest": |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
44 |
adapterTest(args[1], args[2], (args.length >= 4 ? args[3] : "")); |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
45 |
break; |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
46 |
|
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
47 |
case "bug7198834Test": |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
48 |
bug7198834Test(); |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
49 |
break; |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
50 |
|
14185
916ec0a4d039
8000245: SimpleDateFormat.format(date, StringBuffer, FieldPosition) doesn't work as expected with custom extensions
naoto
parents:
14028
diff
changeset
|
51 |
case "tzNameTest": |
916ec0a4d039
8000245: SimpleDateFormat.format(date, StringBuffer, FieldPosition) doesn't work as expected with custom extensions
naoto
parents:
14028
diff
changeset
|
52 |
tzNameTest(args[1]); |
916ec0a4d039
8000245: SimpleDateFormat.format(date, StringBuffer, FieldPosition) doesn't work as expected with custom extensions
naoto
parents:
14028
diff
changeset
|
53 |
break; |
916ec0a4d039
8000245: SimpleDateFormat.format(date, StringBuffer, FieldPosition) doesn't work as expected with custom extensions
naoto
parents:
14028
diff
changeset
|
54 |
|
14336
4a3418a2c07f
8001440: CLDR adapter: Invalid number extension in language tag causes exception in NumberFormat.format()
naoto
parents:
14185
diff
changeset
|
55 |
case "bug8001440Test": |
4a3418a2c07f
8001440: CLDR adapter: Invalid number extension in language tag causes exception in NumberFormat.format()
naoto
parents:
14185
diff
changeset
|
56 |
bug8001440Test(); |
4a3418a2c07f
8001440: CLDR adapter: Invalid number extension in language tag causes exception in NumberFormat.format()
naoto
parents:
14185
diff
changeset
|
57 |
break; |
4a3418a2c07f
8001440: CLDR adapter: Invalid number extension in language tag causes exception in NumberFormat.format()
naoto
parents:
14185
diff
changeset
|
58 |
|
17169
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
14336
diff
changeset
|
59 |
case "bug8010666Test": |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
14336
diff
changeset
|
60 |
bug8010666Test(); |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
14336
diff
changeset
|
61 |
break; |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
14336
diff
changeset
|
62 |
|
17440
fb37aa6b305e
8013086: NPE thrown by SimpleDateFormat with TimeZoneNameProvider supplied
naoto
parents:
17169
diff
changeset
|
63 |
case "bug8013086Test": |
fb37aa6b305e
8013086: NPE thrown by SimpleDateFormat with TimeZoneNameProvider supplied
naoto
parents:
17169
diff
changeset
|
64 |
bug8013086Test(args[1], args[2]); |
fb37aa6b305e
8013086: NPE thrown by SimpleDateFormat with TimeZoneNameProvider supplied
naoto
parents:
17169
diff
changeset
|
65 |
break; |
fb37aa6b305e
8013086: NPE thrown by SimpleDateFormat with TimeZoneNameProvider supplied
naoto
parents:
17169
diff
changeset
|
66 |
|
14028
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
67 |
default: |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
68 |
throw new RuntimeException("Test method '"+methodName+"' not found."); |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
69 |
} |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
70 |
} |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
71 |
|
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
72 |
static void getPlatformLocale(Locale.Category cat) { |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
73 |
Locale defloc = Locale.getDefault(cat); |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
74 |
System.out.printf("%s,%s\n", defloc.getLanguage(), defloc.getCountry()); |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
75 |
} |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
76 |
|
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
77 |
static void adapterTest(String expected, String lang, String ctry) { |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
78 |
Locale testLocale = new Locale(lang, ctry); |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
79 |
String preference = System.getProperty("java.locale.providers", ""); |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
80 |
LocaleProviderAdapter lda = LocaleProviderAdapter.getAdapter(DateFormatProvider.class, testLocale); |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
81 |
LocaleProviderAdapter.Type type = lda.getAdapterType(); |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
82 |
System.out.printf("testLocale: %s, got: %s, expected: %s\n", testLocale, type, expected); |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
83 |
if (!type.toString().equals(expected)) { |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
84 |
throw new RuntimeException("Returned locale data adapter is not correct."); |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
85 |
} |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
86 |
} |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
87 |
|
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
88 |
static void bug7198834Test() { |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
89 |
LocaleProviderAdapter lda = LocaleProviderAdapter.getAdapter(DateFormatProvider.class, Locale.US); |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
90 |
LocaleProviderAdapter.Type type = lda.getAdapterType(); |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
91 |
if (type == LocaleProviderAdapter.Type.HOST && System.getProperty("os.name").startsWith("Windows")) { |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
92 |
DateFormat df = DateFormat.getDateInstance(DateFormat.FULL, Locale.US); |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
93 |
String date = df.format(new Date()); |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
94 |
if (date.charAt(date.length()-1) == ' ') { |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
95 |
throw new RuntimeException("Windows Host Locale Provider returns a trailing space."); |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
96 |
} |
14024
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
97 |
} else { |
14028
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
98 |
System.out.println("Windows HOST locale adapter not found. Ignoring this test."); |
13583 | 99 |
} |
100 |
} |
|
14185
916ec0a4d039
8000245: SimpleDateFormat.format(date, StringBuffer, FieldPosition) doesn't work as expected with custom extensions
naoto
parents:
14028
diff
changeset
|
101 |
|
916ec0a4d039
8000245: SimpleDateFormat.format(date, StringBuffer, FieldPosition) doesn't work as expected with custom extensions
naoto
parents:
14028
diff
changeset
|
102 |
static void tzNameTest(String id) { |
916ec0a4d039
8000245: SimpleDateFormat.format(date, StringBuffer, FieldPosition) doesn't work as expected with custom extensions
naoto
parents:
14028
diff
changeset
|
103 |
TimeZone tz = TimeZone.getTimeZone(id); |
916ec0a4d039
8000245: SimpleDateFormat.format(date, StringBuffer, FieldPosition) doesn't work as expected with custom extensions
naoto
parents:
14028
diff
changeset
|
104 |
String tzName = tz.getDisplayName(false, TimeZone.SHORT, Locale.US); |
916ec0a4d039
8000245: SimpleDateFormat.format(date, StringBuffer, FieldPosition) doesn't work as expected with custom extensions
naoto
parents:
14028
diff
changeset
|
105 |
if (tzName.startsWith("GMT")) { |
916ec0a4d039
8000245: SimpleDateFormat.format(date, StringBuffer, FieldPosition) doesn't work as expected with custom extensions
naoto
parents:
14028
diff
changeset
|
106 |
throw new RuntimeException("JRE's localized time zone name for "+id+" could not be retrieved. Returned name was: "+tzName); |
916ec0a4d039
8000245: SimpleDateFormat.format(date, StringBuffer, FieldPosition) doesn't work as expected with custom extensions
naoto
parents:
14028
diff
changeset
|
107 |
} |
916ec0a4d039
8000245: SimpleDateFormat.format(date, StringBuffer, FieldPosition) doesn't work as expected with custom extensions
naoto
parents:
14028
diff
changeset
|
108 |
} |
14336
4a3418a2c07f
8001440: CLDR adapter: Invalid number extension in language tag causes exception in NumberFormat.format()
naoto
parents:
14185
diff
changeset
|
109 |
|
4a3418a2c07f
8001440: CLDR adapter: Invalid number extension in language tag causes exception in NumberFormat.format()
naoto
parents:
14185
diff
changeset
|
110 |
static void bug8001440Test() { |
4a3418a2c07f
8001440: CLDR adapter: Invalid number extension in language tag causes exception in NumberFormat.format()
naoto
parents:
14185
diff
changeset
|
111 |
Locale locale = Locale.forLanguageTag("th-TH-u-nu-hoge"); |
4a3418a2c07f
8001440: CLDR adapter: Invalid number extension in language tag causes exception in NumberFormat.format()
naoto
parents:
14185
diff
changeset
|
112 |
NumberFormat nf = NumberFormat.getInstance(locale); |
4a3418a2c07f
8001440: CLDR adapter: Invalid number extension in language tag causes exception in NumberFormat.format()
naoto
parents:
14185
diff
changeset
|
113 |
String nu = nf.format(1234560); |
4a3418a2c07f
8001440: CLDR adapter: Invalid number extension in language tag causes exception in NumberFormat.format()
naoto
parents:
14185
diff
changeset
|
114 |
} |
17169
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
14336
diff
changeset
|
115 |
|
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
14336
diff
changeset
|
116 |
// This test assumes Windows localized language/country display names. |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
14336
diff
changeset
|
117 |
static void bug8010666Test() { |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
14336
diff
changeset
|
118 |
if (System.getProperty("os.name").startsWith("Windows")) { |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
14336
diff
changeset
|
119 |
NumberFormat nf = NumberFormat.getInstance(Locale.US); |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
14336
diff
changeset
|
120 |
try { |
17476 | 121 |
double ver = nf.parse(System.getProperty("os.version")) |
122 |
.doubleValue(); |
|
17169
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
14336
diff
changeset
|
123 |
System.out.printf("Windows version: %.1f\n", ver); |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
14336
diff
changeset
|
124 |
if (ver >= 6.0) { |
17476 | 125 |
LocaleProviderAdapter lda = |
126 |
LocaleProviderAdapter.getAdapter( |
|
127 |
LocaleNameProvider.class, Locale.ENGLISH); |
|
17169
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
14336
diff
changeset
|
128 |
LocaleProviderAdapter.Type type = lda.getAdapterType(); |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
14336
diff
changeset
|
129 |
if (type == LocaleProviderAdapter.Type.HOST) { |
17476 | 130 |
LocaleNameProvider lnp = lda.getLocaleNameProvider(); |
17169
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
14336
diff
changeset
|
131 |
Locale mkmk = Locale.forLanguageTag("mk-MK"); |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
14336
diff
changeset
|
132 |
String result = mkmk.getDisplayLanguage(Locale.ENGLISH); |
17476 | 133 |
String hostResult = |
134 |
lnp.getDisplayLanguage(mkmk.getLanguage(), |
|
135 |
Locale.ENGLISH); |
|
136 |
System.out.printf(" Display language name for" + |
|
137 |
" (mk_MK): result(HOST): \"%s\", returned: \"%s\"\n", |
|
138 |
hostResult, result); |
|
139 |
if (result == null || |
|
140 |
hostResult != null && |
|
141 |
!result.equals(hostResult)) { |
|
142 |
throw new RuntimeException("Display language name" + |
|
143 |
" mismatch for \"mk\". Returned name was" + |
|
144 |
" \"" + result + "\", result(HOST): \"" + |
|
145 |
hostResult + "\""); |
|
17169
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
14336
diff
changeset
|
146 |
} |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
14336
diff
changeset
|
147 |
result = Locale.US.getDisplayLanguage(Locale.ENGLISH); |
17476 | 148 |
hostResult = |
149 |
lnp.getDisplayLanguage(Locale.US.getLanguage(), |
|
150 |
Locale.ENGLISH); |
|
151 |
System.out.printf(" Display language name for" + |
|
152 |
" (en_US): result(HOST): \"%s\", returned: \"%s\"\n", |
|
153 |
hostResult, result); |
|
154 |
if (result == null || |
|
155 |
hostResult != null && |
|
156 |
!result.equals(hostResult)) { |
|
157 |
throw new RuntimeException("Display language name" + |
|
158 |
" mismatch for \"en\". Returned name was" + |
|
159 |
" \"" + result + "\", result(HOST): \"" + |
|
160 |
hostResult + "\""); |
|
17169
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
14336
diff
changeset
|
161 |
} |
17476 | 162 |
if (ver >= 6.1) { |
163 |
result = Locale.US.getDisplayCountry(Locale.ENGLISH); |
|
164 |
hostResult = lnp.getDisplayCountry( |
|
165 |
Locale.US.getCountry(), Locale.ENGLISH); |
|
166 |
System.out.printf(" Display country name for" + |
|
167 |
" (en_US): result(HOST): \"%s\", returned: \"%s\"\n", |
|
168 |
hostResult, result); |
|
169 |
if (result == null || |
|
170 |
hostResult != null && |
|
171 |
!result.equals(hostResult)) { |
|
172 |
throw new RuntimeException("Display country name" + |
|
173 |
" mismatch for \"US\". Returned name was" + |
|
174 |
" \"" + result + "\", result(HOST): \"" + |
|
175 |
hostResult + "\""); |
|
176 |
} |
|
17169
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
14336
diff
changeset
|
177 |
} |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
14336
diff
changeset
|
178 |
} else { |
17476 | 179 |
throw new RuntimeException("Windows Host" + |
180 |
" LocaleProviderAdapter was not selected for" + |
|
181 |
" English locale."); |
|
17169
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
14336
diff
changeset
|
182 |
} |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
14336
diff
changeset
|
183 |
} |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
14336
diff
changeset
|
184 |
} catch (ParseException pe) { |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
14336
diff
changeset
|
185 |
throw new RuntimeException("Parsing Windows version failed: "+pe.toString()); |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
14336
diff
changeset
|
186 |
} |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
14336
diff
changeset
|
187 |
} |
5e5039c3181d
8010666: Implement Currency/LocaleNameProvider in Windows Host LocaleProviderAdapter
naoto
parents:
14336
diff
changeset
|
188 |
} |
17440
fb37aa6b305e
8013086: NPE thrown by SimpleDateFormat with TimeZoneNameProvider supplied
naoto
parents:
17169
diff
changeset
|
189 |
|
fb37aa6b305e
8013086: NPE thrown by SimpleDateFormat with TimeZoneNameProvider supplied
naoto
parents:
17169
diff
changeset
|
190 |
static void bug8013086Test(String lang, String ctry) { |
fb37aa6b305e
8013086: NPE thrown by SimpleDateFormat with TimeZoneNameProvider supplied
naoto
parents:
17169
diff
changeset
|
191 |
try { |
fb37aa6b305e
8013086: NPE thrown by SimpleDateFormat with TimeZoneNameProvider supplied
naoto
parents:
17169
diff
changeset
|
192 |
// Throws a NullPointerException if the test fails. |
fb37aa6b305e
8013086: NPE thrown by SimpleDateFormat with TimeZoneNameProvider supplied
naoto
parents:
17169
diff
changeset
|
193 |
System.out.println(new SimpleDateFormat("z", new Locale(lang, ctry)).parse("UTC")); |
fb37aa6b305e
8013086: NPE thrown by SimpleDateFormat with TimeZoneNameProvider supplied
naoto
parents:
17169
diff
changeset
|
194 |
} catch (ParseException pe) { |
fb37aa6b305e
8013086: NPE thrown by SimpleDateFormat with TimeZoneNameProvider supplied
naoto
parents:
17169
diff
changeset
|
195 |
// ParseException is fine in this test, as it's not "UTC" |
13583 | 196 |
} |
17440
fb37aa6b305e
8013086: NPE thrown by SimpleDateFormat with TimeZoneNameProvider supplied
naoto
parents:
17169
diff
changeset
|
197 |
} |
fb37aa6b305e
8013086: NPE thrown by SimpleDateFormat with TimeZoneNameProvider supplied
naoto
parents:
17169
diff
changeset
|
198 |
} |