test/jdk/java/util/TimeZone/Bug8149452.java
author naoto
Fri, 26 Jul 2019 08:56:28 -0700
changeset 57544 99d2dd7b84a8
parent 51247 13e816d02c25
permissions -rw-r--r--
8212970: TZ database in "vanguard" format support Reviewed-by: rriggs, joehw, erikj, scolebourne
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
38440
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
     1
/*
49904
cadca99d52e7 8181157: CLDR Timezone name fallback implementation
naoto
parents: 47216
diff changeset
     2
 * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
38440
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
     4
 *
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
     7
 * published by the Free Software Foundation.
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
     8
 *
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    13
 * accompanied this code).
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    14
 *
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    18
 *
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    21
 * questions.
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    22
 */
51247
13e816d02c25 8206965: java/util/TimeZone/Bug8149452.java failed on de_DE and ja_JP locale.
rgoel
parents: 49904
diff changeset
    23
 /*
38440
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    24
 * @test
51247
13e816d02c25 8206965: java/util/TimeZone/Bug8149452.java failed on de_DE and ja_JP locale.
rgoel
parents: 49904
diff changeset
    25
 * @bug 8149452 8151876 8181157 8206965
13e816d02c25 8206965: java/util/TimeZone/Bug8149452.java failed on de_DE and ja_JP locale.
rgoel
parents: 49904
diff changeset
    26
 * @modules java.base/sun.util.calendar
13e816d02c25 8206965: java/util/TimeZone/Bug8149452.java failed on de_DE and ja_JP locale.
rgoel
parents: 49904
diff changeset
    27
 * @run main/othervm -Duser.language=de -Duser.country=DE Bug8149452
13e816d02c25 8206965: java/util/TimeZone/Bug8149452.java failed on de_DE and ja_JP locale.
rgoel
parents: 49904
diff changeset
    28
 * @run main/othervm -Duser.language=ja -Duser.country=JP Bug8149452
13e816d02c25 8206965: java/util/TimeZone/Bug8149452.java failed on de_DE and ja_JP locale.
rgoel
parents: 49904
diff changeset
    29
 * @run main/othervm -Duser.language=en -Duser.country=US Bug8149452
13e816d02c25 8206965: java/util/TimeZone/Bug8149452.java failed on de_DE and ja_JP locale.
rgoel
parents: 49904
diff changeset
    30
 * @summary Check the missing time zone names for English, German and Japanese locales.
38440
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    31
 */
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    32
import java.text.DateFormatSymbols;
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    33
import java.util.ArrayList;
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    34
import java.util.TimeZone;
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    35
import java.util.Arrays;
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    36
import java.util.List;
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    37
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    38
public class Bug8149452 {
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    39
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    40
    public static void main(String[] args) {
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    41
        List<String> listNotFound = new ArrayList<>();
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    42
        String[][] zoneStrings = DateFormatSymbols.getInstance()
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    43
                .getZoneStrings();
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    44
        for (String tzID : TimeZone.getAvailableIDs()) {
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    45
            if (!Arrays.stream(zoneStrings)
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    46
                    .anyMatch(zone -> tzID.equalsIgnoreCase(zone[0]))) {
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    47
                // to ignore names for Etc/GMT[+-][0-9]+ which are not supported
38768
7d6930523e38 8151876: (tz) Support tzdata2016d
rpatil
parents: 38440
diff changeset
    48
                if (!tzID.startsWith("Etc/GMT")
51247
13e816d02c25 8206965: java/util/TimeZone/Bug8149452.java failed on de_DE and ja_JP locale.
rgoel
parents: 49904
diff changeset
    49
                        && !tzID.startsWith("GMT")) {
38440
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    50
                    listNotFound.add(tzID);
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    51
                }
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    52
            }
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    53
        }
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    54
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    55
        if (!listNotFound.isEmpty()) {
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    56
            throw new RuntimeException("Test Failed: Time Zone Strings for "
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    57
                    + listNotFound + " not found");
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    58
        }
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    59
    }
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents:
diff changeset
    60
}