Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/java/text/Format/DateFormat/bug4117335.java
47182 views
/*1* Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test25*26* @bug 4117335 443261727*/2829import java.text.DateFormatSymbols ;30import java.util.Locale;3132public class bug4117335 {3334public static void main(String[] args) throws Exception35{36DateFormatSymbols symbols = new DateFormatSymbols(Locale.JAPAN);37String[] eras = symbols.getEras();38System.out.println("BC = " + eras[0]);39if (!eras[0].equals(bc)) {40System.out.println("*** Should have been " + bc);41throw new Exception("Error in BC");42}43System.out.println("AD = " + eras[1]);44if (!eras[1].equals(ad)) {45System.out.println("*** Should have been " + ad);46throw new Exception("Error in AD");47}48String[][] zones = symbols.getZoneStrings();49for (int i = 0; i < zones.length; i++) {50if (!"Asia/Tokyo".equals(zones[i][0])) {51continue;52}53System.out.println("Long zone name = " + zones[i][1]);54if (!zones[i][1].equals(jstLong)) {55System.out.println("*** Should have been " + jstLong);56throw new Exception("Error in long TZ name");57}58System.out.println("Short zone name = " + zones[i][2]);59if (!zones[i][2].equals(jstShort)) {60System.out.println("*** Should have been " + jstShort);61throw new Exception("Error in short TZ name");62}63System.out.println("Long zone name = " + zones[i][3]);64if (!zones[i][3].equals(jdtLong)) {65System.out.println("*** Should have been " + jdtLong);66throw new Exception("Error in long TZ name");67}68System.out.println("SHORT zone name = " + zones[i][4]);69if (!zones[i][4].equals(jdtShort)) {70System.out.println("*** Should have been " + jdtShort);71throw new Exception("Error in short TZ name");72}73}74}7576static final String bc = "\u7d00\u5143\u524d";77static final String ad = "\u897f\u66a6";78static final String jstLong = "\u65e5\u672c\u6a19\u6e96\u6642";79static final String jstShort = "JST";80static final String jdtLong = "\u65e5\u672c\u590f\u6642\u9593";81static final String jdtShort = "JDT";82}838485