0N/A/*
2362N/A * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/A/*
0N/A *@test
0N/A *@bug 4848242
0N/A *@summary Make sure that MET time zone is not misinterpreted in euro locales.
0N/A * Display the MET and MEST TZ human-readable name in all euro locales.
0N/A */
0N/A
0N/Aimport java.util.Locale;
0N/Aimport java.util.TimeZone;
0N/Aimport java.text.DateFormatSymbols;
0N/A
0N/Apublic class Bug4848242 {
0N/A
0N/A public static void main(String[] args) {
0N/A getTzInfo("de", "DE");
0N/A getTzInfo("es", "ES");
0N/A getTzInfo("fr", "FR");
0N/A getTzInfo("it", "IT");
0N/A getTzInfo("sv", "SV");
0N/A }
0N/A
0N/A static void getTzInfo(String langName, String locName)
0N/A {
0N/A Locale tzLocale = new Locale(langName, locName);
0N/A TimeZone euroTz = TimeZone.getTimeZone("MET");
0N/A
0N/A System.out.println("Locale is " + langName + "_" + locName);
0N/A
0N/A if ( euroTz.getID().equalsIgnoreCase("GMT") ) {
0N/A // if we don't have a timezone and default back to GMT
0N/A throw new RuntimeException("Error: no time zone found");
0N/A }
0N/A
0N/A // get the timezone info
0N/A System.out.println(euroTz.getDisplayName(false, TimeZone.SHORT, tzLocale));
0N/A if(!euroTz.getDisplayName(false, TimeZone.SHORT, tzLocale).equals("MET"))
0N/A throw new RuntimeException("Timezone name is incorrect (should be MET)\n");
0N/A System.out.println(euroTz.getDisplayName(false, TimeZone.LONG, tzLocale));
0N/A
0N/A System.out.println(euroTz.getDisplayName(true, TimeZone.SHORT, tzLocale));
0N/A if(!euroTz.getDisplayName(true, TimeZone.SHORT, tzLocale).equals("MEST"))
0N/A throw new RuntimeException("Summer timezone name is incorrect (should be MEST)\n");
0N/A System.out.println(euroTz.getDisplayName(true, TimeZone.LONG, tzLocale) + "\n");
0N/A
0N/A }
0N/A
0N/A}