8278434: timeouts in test java/time/test/java/time/format/TestZoneTextPrinterParser.java

Backport-of: 8dc4437d00
This commit is contained in:
Naoto Sato 2022-01-13 22:05:52 +00:00
parent ff85659311
commit 064ee6ae13
3 changed files with 66 additions and 14 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -151,8 +151,8 @@ public class CLDRTimeZoneNameProviderImpl extends TimeZoneNameProviderImpl {
// Check parent locales first
if (!exists(names, index)) {
CLDRLocaleProviderAdapter clpa = (CLDRLocaleProviderAdapter)LocaleProviderAdapter.forType(Type.CLDR);
var cands = clpa.getCandidateLocales("", locale);
var cands = ((CLDRLocaleProviderAdapter)LocaleProviderAdapter.forType(Type.CLDR))
.getCandidateLocales("", locale);
for (int i = 1; i < cands.size() ; i++) {
String[] parentNames = super.getDisplayNameArray(id, cands.get(i));
if (parentNames != null && !parentNames[index].isEmpty()) {
@ -162,11 +162,6 @@ public class CLDRTimeZoneNameProviderImpl extends TimeZoneNameProviderImpl {
}
}
// Region Fallback
if (regionFormatFallback(names, index, locale)) {
return;
}
// Type Fallback
if (noDST && typeFallback(names, index)) {
return;
@ -185,6 +180,11 @@ public class CLDRTimeZoneNameProviderImpl extends TimeZoneNameProviderImpl {
}
}
// Region Fallback
if (regionFormatFallback(names, index, locale)) {
return;
}
// last resort
names[index] = toGMTFormat(id,
index == INDEX_DST_LONG || index == INDEX_DST_SHORT,
@ -230,6 +230,11 @@ public class CLDRTimeZoneNameProviderImpl extends TimeZoneNameProviderImpl {
}
private boolean regionFormatFallback(String[] names, int index, Locale l) {
if (index % 2 == 0) {
// ignore short names
return false;
}
String id = names[INDEX_TZID];
LocaleResources lr = LocaleProviderAdapter.forType(Type.CLDR).getLocaleResources(l);
ResourceBundle fd = lr.getJavaTimeFormatData();