1 /*
2  * Copyright (c) 1998, 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  *
27  * @bug 4117335 4432617
28  * @modules jdk.localedata
29  */
30 
31 import java.text.DateFormatSymbols ;
32 import java.util.Locale;
33 
34 public class bug4117335 {
35 
main(String[] args)36     public static void main(String[] args) throws Exception
37     {
38         DateFormatSymbols symbols = new DateFormatSymbols(Locale.JAPAN);
39         String[] eras = symbols.getEras();
40         System.out.println("BC = " + eras[0]);
41         if (!eras[0].equals(bc)) {
42             System.out.println("*** Should have been " + bc);
43             throw new Exception("Error in BC");
44         }
45         System.out.println("AD = " + eras[1]);
46         if (!eras[1].equals(ad)) {
47             System.out.println("*** Should have been " + ad);
48             throw new Exception("Error in AD");
49         }
50         String[][] zones = symbols.getZoneStrings();
51         for (int i = 0; i < zones.length; i++) {
52             if (!"Asia/Tokyo".equals(zones[i][0])) {
53                 continue;
54             }
55             System.out.println("Long zone name = " + zones[i][1]);
56             if (!zones[i][1].equals(jstLong)) {
57                 System.out.println("*** Should have been " + jstLong);
58                 throw new Exception("Error in long TZ name");
59             }
60             System.out.println("Short zone name = " + zones[i][2]);
61             if (!zones[i][2].equals(jstShort)) {
62                 System.out.println("*** Should have been " + jstShort);
63                 throw new Exception("Error in short TZ name");
64             }
65             System.out.println("Long zone name = " + zones[i][3]);
66             if (!zones[i][3].equals(jdtLong)) {
67                 System.out.println("*** Should have been " + jdtLong);
68                 throw new Exception("Error in long TZ name");
69             }
70             System.out.println("SHORT zone name = " + zones[i][4]);
71             if (!zones[i][4].equals(jdtShort)) {
72                 System.out.println("*** Should have been " + jdtShort);
73                 throw new Exception("Error in short TZ name");
74             }
75         }
76     }
77 
78     static final String bc = "\u7d00\u5143\u524d";
79     static final String ad = "\u897f\u66a6";
80     static final String jstLong = "\u65e5\u672c\u6a19\u6e96\u6642";
81     static final String jstShort = "JST";
82     static final String jdtLong = "\u65e5\u672c\u590f\u6642\u9593";
83     static final String jdtShort = "JDT";
84 }
85