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