You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2015/06/19 17:16:52 UTC

svn commit: r1686432 - /tomcat/trunk/java/org/apache/tomcat/util/http/FastHttpDateFormat.java

Author: remm
Date: Fri Jun 19 15:16:51 2015
New Revision: 1686432

URL: http://svn.apache.org/r1686432
Log:
Remove unused shared formats.

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/http/FastHttpDateFormat.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/http/FastHttpDateFormat.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/http/FastHttpDateFormat.java?rev=1686432&r1=1686431&r2=1686432&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/http/FastHttpDateFormat.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/http/FastHttpDateFormat.java Fri Jun 19 15:16:51 2015
@@ -49,16 +49,6 @@ public final class FastHttpDateFormat {
             new SimpleDateFormat(RFC1123_DATE, Locale.US);
 
 
-    /**
-     * The set of SimpleDateFormat formats to use in getDateHeader().
-     */
-    private static final SimpleDateFormat formats[] = {
-        new SimpleDateFormat(RFC1123_DATE, Locale.US),
-        new SimpleDateFormat("EEEEEE, dd-MMM-yy HH:mm:ss zzz", Locale.US),
-        new SimpleDateFormat("EEE MMMM d HH:mm:ss yyyy", Locale.US)
-    };
-
-
     private static final TimeZone gmtZone = TimeZone.getTimeZone("GMT");
 
 
@@ -66,13 +56,7 @@ public final class FastHttpDateFormat {
      * GMT timezone - all HTTP dates are on GMT
      */
     static {
-
         format.setTimeZone(gmtZone);
-
-        formats[0].setTimeZone(gmtZone);
-        formats[1].setTimeZone(gmtZone);
-        formats[2].setTimeZone(gmtZone);
-
     }
 
 
@@ -166,9 +150,6 @@ public final class FastHttpDateFormat {
         if (threadLocalformats != null) {
             date = internalParseDate(value, threadLocalformats);
             updateParseCache(value, date);
-        } else {
-            date = internalParseDate(value, formats);
-            updateParseCache(value, date);
         }
         if (date == null) {
             return (-1L);



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r1686432 - /tomcat/trunk/java/org/apache/tomcat/util/http/FastHttpDateFormat.java

Posted by sebb <se...@gmail.com>.
On 19 June 2015 at 16:16,  <re...@apache.org> wrote:
> Author: remm
> Date: Fri Jun 19 15:16:51 2015
> New Revision: 1686432
>
> URL: http://svn.apache.org/r1686432
> Log:
> Remove unused shared formats.
>
> Modified:
>     tomcat/trunk/java/org/apache/tomcat/util/http/FastHttpDateFormat.java
>
> Modified: tomcat/trunk/java/org/apache/tomcat/util/http/FastHttpDateFormat.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/http/FastHttpDateFormat.java?rev=1686432&r1=1686431&r2=1686432&view=diff
> ==============================================================================
> --- tomcat/trunk/java/org/apache/tomcat/util/http/FastHttpDateFormat.java (original)
> +++ tomcat/trunk/java/org/apache/tomcat/util/http/FastHttpDateFormat.java Fri Jun 19 15:16:51 2015
> @@ -49,16 +49,6 @@ public final class FastHttpDateFormat {
>              new SimpleDateFormat(RFC1123_DATE, Locale.US);
>
>
> -    /**
> -     * The set of SimpleDateFormat formats to use in getDateHeader().
> -     */
> -    private static final SimpleDateFormat formats[] = {
> -        new SimpleDateFormat(RFC1123_DATE, Locale.US),
> -        new SimpleDateFormat("EEEEEE, dd-MMM-yy HH:mm:ss zzz", Locale.US),
> -        new SimpleDateFormat("EEE MMMM d HH:mm:ss yyyy", Locale.US)
> -    };
> -
> -
>      private static final TimeZone gmtZone = TimeZone.getTimeZone("GMT");
>
>
> @@ -66,13 +56,7 @@ public final class FastHttpDateFormat {
>       * GMT timezone - all HTTP dates are on GMT
>       */
>      static {
> -
>          format.setTimeZone(gmtZone);
> -
> -        formats[0].setTimeZone(gmtZone);
> -        formats[1].setTimeZone(gmtZone);
> -        formats[2].setTimeZone(gmtZone);
> -
>      }
>
>
> @@ -166,9 +150,6 @@ public final class FastHttpDateFormat {
>          if (threadLocalformats != null) {

Does it make sense to allow null?
It won't crash, but it won't return anything useful (unless some other
caller has populated the relevant cache entry).

I would have thought it might be more useful to throw an IAE / NPE at
the start of the method if the parameter is null.

>              date = internalParseDate(value, threadLocalformats);
>              updateParseCache(value, date);
> -        } else {
> -            date = internalParseDate(value, formats);
> -            updateParseCache(value, date);
>          }
>          if (date == null) {
>              return (-1L);
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org