You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2023/12/13 08:23:56 UTC

(httpcomponents-core) 29/37: HTTPCORE-756: Better name for the standard date pattern

This is an automated email from the ASF dual-hosted git repository.

olegk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git

commit a2d88f4280f1d3ee6d51d705187d918d218d56c3
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Sun Oct 8 22:24:16 2023 +0200

    HTTPCORE-756: Better name for the standard date pattern
---
 .../hc/core5/http/protocol/HttpDateGenerator.java     | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/HttpDateGenerator.java b/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/HttpDateGenerator.java
index 385a8ba01..469dd17a4 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/HttpDateGenerator.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/HttpDateGenerator.java
@@ -47,8 +47,12 @@ public class HttpDateGenerator {
 
     private static final int GRANULARITY_MILLIS = 1000;
 
-    /** Date format pattern used to generate the header in RFC 1123 format. */
+    /**
+     * @deprecated Use {@link #INTERNET_MESSAGE_FORMAT}
+     */
+    @Deprecated
     public static final String PATTERN_RFC1123 = "EEE, dd MMM yyyy HH:mm:ss zzz";
+    public static final String INTERNET_MESSAGE_FORMAT = "EEE, dd MMM yyyy HH:mm:ss zzz";
 
     /**
      * @deprecated This attribute is no longer supported as a part of the public API.
@@ -60,7 +64,7 @@ public class HttpDateGenerator {
     public static final ZoneId GMT_ID = ZoneId.of("GMT");
 
     /** Singleton instance. */
-    public static final HttpDateGenerator INSTANCE = new HttpDateGenerator(PATTERN_RFC1123, GMT_ID);
+    public static final HttpDateGenerator INSTANCE = new HttpDateGenerator(INTERNET_MESSAGE_FORMAT, GMT_ID);
 
     private final DateTimeFormatter dateTimeFormatter;
     private long dateAsMillis;
@@ -69,17 +73,6 @@ public class HttpDateGenerator {
 
     private final ReentrantLock lock;
 
-    HttpDateGenerator() {
-        dateTimeFormatter =new DateTimeFormatterBuilder()
-                .parseLenient()
-                .parseCaseInsensitive()
-                .appendPattern(PATTERN_RFC1123)
-                .toFormatter();
-        zoneId = GMT_ID;
-        this.lock = new ReentrantLock();
-
-    }
-
     private HttpDateGenerator(final String pattern, final ZoneId zoneId) {
         dateTimeFormatter = new DateTimeFormatterBuilder()
                 .parseLenient()