Add invariant check in FastDateParser.appendDisplayNames(Calendar,

Locale, int, StringBuilder)
This commit is contained in:
Gary Gregory 2023-08-10 14:13:19 -04:00
parent 861d191505
commit 075b3e1a40
1 changed files with 1 additions and 0 deletions

View File

@ -488,6 +488,7 @@ public class FastDateParser implements DateParser, Serializable {
*/ */
private static Map<String, Integer> appendDisplayNames(final Calendar calendar, final Locale locale, final int field, private static Map<String, Integer> appendDisplayNames(final Calendar calendar, final Locale locale, final int field,
final StringBuilder regex) { final StringBuilder regex) {
Objects.requireNonNull(calendar, "calendar");
final Map<String, Integer> values = new HashMap<>(); final Map<String, Integer> values = new HashMap<>();
final Locale actualLocale = LocaleUtils.toLocale(locale); final Locale actualLocale = LocaleUtils.toLocale(locale);
final Map<String, Integer> displayNames = calendar.getDisplayNames(field, Calendar.ALL_STYLES, actualLocale); final Map<String, Integer> displayNames = calendar.getDisplayNames(field, Calendar.ALL_STYLES, actualLocale);