|
23 | 23 |
|
24 | 24 | import java.text.DateFormatSymbols; |
25 | 25 | import java.text.ParseException; |
| 26 | +import java.time.ZoneId; |
26 | 27 | import java.util.ArrayList; |
27 | 28 | import java.util.Comparator; |
28 | 29 | import java.util.Date; |
@@ -110,6 +111,9 @@ private void testTimeZoneStrategyPattern_DateFormatSymbols_getZoneStrings(final |
110 | 111 |
|
111 | 112 | final String[][] zones = getZoneStringsSorted(locale); |
112 | 113 | for (final String[] zone : zones) { |
| 114 | + if (isInvalidZoneId(zone[0])) { |
| 115 | + continue; |
| 116 | + } |
113 | 117 | for (int zIndex = 1; zIndex < zone.length; ++zIndex) { |
114 | 118 | final String tzDisplay = zone[zIndex]; |
115 | 119 | if (tzDisplay == null) { |
@@ -171,6 +175,9 @@ private void testTimeZoneStrategyPattern_TimeZone_getAvailableIDs(final Locale l |
171 | 175 | assumeFalse(LocaleUtils.isLanguageUndetermined(locale), () -> toFailureMessage(locale, null, null)); |
172 | 176 | assumeTrue(LocaleUtils.isAvailableLocale(locale), () -> toFailureMessage(locale, null, null)); |
173 | 177 | for (final String id : ArraySorter.sort(TimeZone.getAvailableIDs())) { |
| 178 | + if (isInvalidZoneId(id)) { |
| 179 | + continue; |
| 180 | + } |
174 | 181 | final TimeZone timeZone = TimeZone.getTimeZone(id); |
175 | 182 | final String displayName = timeZone.getDisplayName(locale); |
176 | 183 | final FastDateParser parser = new FastDateParser("z", timeZone, locale); |
@@ -226,4 +233,12 @@ private String toFailureMessage(final Locale locale, final String languageTag, f |
226 | 233 | return String.format("locale = %s, languageTag = '%s', isAvailableLocale = %s, isLanguageUndetermined = %s, timeZone = %s", languageTag, locale, |
227 | 234 | LocaleUtils.isAvailableLocale(locale), LocaleUtils.isLanguageUndetermined(locale), TimeZones.toTimeZone(timeZone)); |
228 | 235 | } |
| 236 | + |
| 237 | + /** |
| 238 | + * skip short IDs on Java 25+ as they are not supported there |
| 239 | + */ |
| 240 | + private boolean isInvalidZoneId(final String zoneId) { |
| 241 | + return SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_25) |
| 242 | + && ZoneId.SHORT_IDS.containsKey(zoneId); |
| 243 | + } |
229 | 244 | } |
0 commit comments