From f055b3e83bffa4401fcbec9a19f694f84ec760ea Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Sat, 13 Nov 2021 17:09:45 +0100 Subject: [PATCH] Apply English locale to all date header formatters --- .../java/org/apache/hc/client5/http/utils/DateUtils.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/utils/DateUtils.java b/httpclient5/src/main/java/org/apache/hc/client5/http/utils/DateUtils.java index a04420161..125ff53f7 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/utils/DateUtils.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/utils/DateUtils.java @@ -35,6 +35,7 @@ import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatterBuilder; import java.time.format.DateTimeParseException; import java.util.Date; +import java.util.Locale; import java.util.TimeZone; import org.apache.hc.core5.http.Header; @@ -64,7 +65,7 @@ public final class DateUtils { .parseLenient() .parseCaseInsensitive() .appendPattern(PATTERN_RFC1123) - .toFormatter(); + .toFormatter(Locale.ENGLISH); /** * Date format pattern used to parse HTTP date headers in RFC 1036 format. @@ -80,7 +81,7 @@ public final class DateUtils { .parseLenient() .parseCaseInsensitive() .appendPattern(PATTERN_RFC1036) - .toFormatter(); + .toFormatter(Locale.ENGLISH); /** * Date format pattern used to parse HTTP date headers in ANSI C @@ -97,7 +98,7 @@ public final class DateUtils { .parseLenient() .parseCaseInsensitive() .appendPattern(PATTERN_ASCTIME) - .toFormatter(); + .toFormatter(Locale.ENGLISH); /** * Standard date formatters: {@link #FORMATTER_RFC1123}, {@link #FORMATTER_RFC1036}, {@link #FORMATTER_ASCTIME}.