This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 7e5f26343a26a4589b6910015eea987dccfb4be2 Author: Mark Thomas <ma...@apache.org> AuthorDate: Mon Jul 29 21:05:15 2019 +0100 Deprecate FastDateFormat.RFC1123_DATE --- java/org/apache/catalina/connector/Request.java | 10 +++++++++- java/org/apache/catalina/connector/Response.java | 21 +++++---------------- .../apache/tomcat/util/http/FastHttpDateFormat.java | 3 +++ 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/java/org/apache/catalina/connector/Request.java b/java/org/apache/catalina/connector/Request.java index 1e95e74..c58cda1 100644 --- a/java/org/apache/catalina/connector/Request.java +++ b/java/org/apache/catalina/connector/Request.java @@ -167,6 +167,10 @@ public class Request implements org.apache.catalina.servlet4preview.http.HttpSer // ----------------------------------------------------- Variables + /** + * @deprecated Unused. This will be removed in Tomcat 10. + */ + @Deprecated protected static final TimeZone GMT_ZONE = TimeZone.getTimeZone("GMT"); @@ -187,9 +191,13 @@ public class Request implements org.apache.catalina.servlet4preview.http.HttpSer * * Notice that because SimpleDateFormat is not thread-safe, we can't * declare formats[] as a static variable. + * + * @deprecated Unused. This will be removed in Tomcat 10 */ + @Deprecated protected final SimpleDateFormat formats[]; + @Deprecated private static final SimpleDateFormat formatsTemplate[] = { new SimpleDateFormat(FastHttpDateFormat.RFC1123_DATE, Locale.US), new SimpleDateFormat("EEEEEE, dd-MMM-yy HH:mm:ss zzz", Locale.US), @@ -2223,7 +2231,7 @@ public class Request implements org.apache.catalina.servlet4preview.http.HttpSer } // Attempt to convert the date header in a variety of formats - long result = FastHttpDateFormat.parseDate(value, formats); + long result = FastHttpDateFormat.parseDate(value); if (result != (-1L)) { return result; } diff --git a/java/org/apache/catalina/connector/Response.java b/java/org/apache/catalina/connector/Response.java index b3c4f13..7410d5a 100644 --- a/java/org/apache/catalina/connector/Response.java +++ b/java/org/apache/catalina/connector/Response.java @@ -32,7 +32,6 @@ import java.util.Collection; import java.util.Enumeration; import java.util.List; import java.util.Locale; -import java.util.TimeZone; import javax.servlet.ServletOutputStream; import javax.servlet.ServletResponse; @@ -91,7 +90,10 @@ public class Response implements HttpServletResponse { /** * The date format we will use for creating date headers. + * + * @deprecated Unused. This will be removed in Tomcat 10 */ + @Deprecated protected SimpleDateFormat format = null; @@ -1003,14 +1005,7 @@ public class Response implements HttpServletResponse { return; } - if (format == null) { - format = new SimpleDateFormat(FastHttpDateFormat.RFC1123_DATE, - Locale.US); - format.setTimeZone(TimeZone.getTimeZone("GMT")); - } - - addHeader(name, FastHttpDateFormat.formatDate(value, format)); - + addHeader(name, FastHttpDateFormat.formatDate(value)); } @@ -1366,13 +1361,7 @@ public class Response implements HttpServletResponse { return; } - if (format == null) { - format = new SimpleDateFormat(FastHttpDateFormat.RFC1123_DATE, - Locale.US); - format.setTimeZone(TimeZone.getTimeZone("GMT")); - } - - setHeader(name, FastHttpDateFormat.formatDate(value, format)); + setHeader(name, FastHttpDateFormat.formatDate(value)); } diff --git a/java/org/apache/tomcat/util/http/FastHttpDateFormat.java b/java/org/apache/tomcat/util/http/FastHttpDateFormat.java index 86376d2..dd9bd2b 100644 --- a/java/org/apache/tomcat/util/http/FastHttpDateFormat.java +++ b/java/org/apache/tomcat/util/http/FastHttpDateFormat.java @@ -41,7 +41,10 @@ public final class FastHttpDateFormat { /** * The only date format permitted when generating HTTP headers. + * + * @deprecated Unused. This will be removed in Tomcat 10. */ + @Deprecated public static final String RFC1123_DATE = "EEE, dd MMM yyyy HH:mm:ss zzz"; // HTTP date formats --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org