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