Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/sun/util/resources/TimeZone/Bug6377794.java
38853 views
1
/*
2
* Copyright (c) 2007, 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 6377794
27
*@summary Test case for tzdata2005r support for 9 locales
28
*/
29
30
import java.util.Locale;
31
import java.util.TimeZone;
32
33
public class Bug6377794 {
34
static Locale[] locales2Test = new Locale[] {
35
new Locale("en"),
36
new Locale("de"),
37
new Locale("es"),
38
new Locale("fr"),
39
new Locale("it"),
40
new Locale("ja"),
41
new Locale("ko"),
42
new Locale("sv"),
43
new Locale("zh","CN"),
44
new Locale("zh","TW")
45
};
46
47
public static void main(String[] args) {
48
TimeZone SystemVYST9 = TimeZone.getTimeZone("SystemV/YST9");
49
Locale tzLocale;
50
for (int i = 0; i < locales2Test.length; i++) {
51
tzLocale = locales2Test[i];
52
if (!SystemVYST9.getDisplayName(false, TimeZone.SHORT, tzLocale).equals
53
("AKST"))
54
throw new RuntimeException("\n" + tzLocale + ": SHORT, " +
55
"non-daylight saving name for " +
56
"SystemV/YST9 should be \"AKST\"");
57
}
58
59
/*
60
* For "SystemV/PST8", testing TimeZone.SHORT would return the same value
61
* before and after the fix. Therefore, the regression test was changed to test
62
* TimeZone.LONG instead.
63
*/
64
65
TimeZone SystemVPST8 = TimeZone.getTimeZone("SystemV/PST8");
66
tzLocale = locales2Test[0];
67
if (!SystemVPST8.getDisplayName(false, TimeZone.LONG, tzLocale).equals
68
("Pacific Standard Time"))
69
throw new RuntimeException("\n" + tzLocale + ": LONG, " +
70
"non-daylight saving name for " +
71
"SystemV/PST8 should be " +
72
"\"Pacific Standard Time\"");
73
tzLocale = locales2Test[1];
74
if (!SystemVPST8.getDisplayName(false, TimeZone.LONG, tzLocale).equals
75
("Pazifische Normalzeit"))
76
throw new RuntimeException("\n" + tzLocale + ": LONG, " +
77
"non-daylight saving name for " +
78
"SystemV/PST8 should be " +
79
"\"Pazifische Normalzeit\"");
80
tzLocale = locales2Test[2];
81
if (!SystemVPST8.getDisplayName(false, TimeZone.LONG, tzLocale).equals
82
("Hora est\u00e1ndar del Pac\u00edfico"))
83
throw new RuntimeException("\n" + tzLocale + ": LONG, " +
84
"non-daylight saving name for " +
85
"SystemV/PST8 should be " +
86
"\"Hora est\u00e1ndar del Pac\u00edfico\"");
87
tzLocale = locales2Test[3];
88
if (!SystemVPST8.getDisplayName(false, TimeZone.LONG, tzLocale).equals
89
("Heure normale du Pacifique"))
90
throw new RuntimeException("\n" + tzLocale + ": LONG, " +
91
"non-daylight saving name for " +
92
"SystemV/PST8 should be " +
93
"\"Heure normale du Pacifique\"");
94
tzLocale = locales2Test[4];
95
if (!SystemVPST8.getDisplayName(false, TimeZone.LONG, tzLocale).equals
96
("Ora solare della costa occidentale USA"))
97
throw new RuntimeException("\n" + tzLocale + ": LONG, " +
98
"non-daylight saving name for " +
99
"SystemV/PST8 should be " +
100
"\"Ora solare della costa occidentale USA\"");
101
tzLocale = locales2Test[5];
102
if (!SystemVPST8.getDisplayName(false, TimeZone.LONG, tzLocale).equals
103
("\u592a\u5e73\u6d0b\u6a19\u6e96\u6642"))
104
throw new RuntimeException("\n" + tzLocale + ": LONG, " +
105
"non-daylight saving name for " +
106
"SystemV/PST8 should be " +
107
"\"\u592a\u5e73\u6d0b\u6a19\u6e96\u6642\"");
108
tzLocale = locales2Test[6];
109
if (!SystemVPST8.getDisplayName(false, TimeZone.LONG, tzLocale).equals
110
("\ud0dc\ud3c9\uc591 \ud45c\uc900\uc2dc"))
111
throw new RuntimeException("\n" + tzLocale + ": LONG, " +
112
"non-daylight saving name for " +
113
"SystemV/PST8 should be " +
114
"\"\ud0dc\ud3c9\uc591 \ud45c\uc900\uc2dc\"");
115
tzLocale = locales2Test[7];
116
if (!SystemVPST8.getDisplayName(false, TimeZone.LONG, tzLocale).equals
117
("Stilla havet, normaltid"))
118
throw new RuntimeException("\n" + tzLocale + ": LONG, " +
119
"non-daylight saving name for " +
120
"SystemV/PST8 should be " +
121
"\"Stilla havet, normaltid\"");
122
tzLocale = locales2Test[8];
123
if (!SystemVPST8.getDisplayName(false, TimeZone.LONG, tzLocale).equals
124
("\u592a\u5e73\u6d0b\u6807\u51c6\u65f6\u95f4"))
125
throw new RuntimeException("\n" + tzLocale + ": LONG, " +
126
"non-daylight saving name for " +
127
"SystemV/PST8 should be " +
128
"\"\u592a\u5e73\u6d0b\u6807\u51c6\u65f6\u95f4\"");
129
tzLocale = locales2Test[9];
130
if (!SystemVPST8.getDisplayName(false, TimeZone.LONG, tzLocale).equals
131
("\u592a\u5e73\u6d0b\u6a19\u6e96\u6642\u9593"))
132
throw new RuntimeException("\n" + tzLocale + ": LONG, " +
133
"non-daylight saving name for " +
134
"SystemV/PST8 should be " +
135
"\"\u592a\u5e73\u6d0b\u6a19\u6e96\u6642\u9593\"");
136
}
137
}
138
139