Index: ./appserv-webtier/src/java/org/apache/tomcat/util/http/ServerCookie.java =================================================================== RCS file: /cvs/glassfish/appserv-webtier/src/java/org/apache/tomcat/util/http/ServerCookie.java,v retrieving revision 1.7 diff -u -r1.7 ServerCookie.java --- ./appserv-webtier/src/java/org/apache/tomcat/util/http/ServerCookie.java 7 Aug 2006 23:48:57 -0000 1.7 +++ ./appserv-webtier/src/java/org/apache/tomcat/util/http/ServerCookie.java 26 Nov 2008 12:18:28 -0000 @@ -27,7 +27,6 @@ package org.apache.tomcat.util.http; import org.apache.tomcat.util.buf.MessageBytes; -import org.apache.tomcat.util.buf.DateTool; import java.text.*; import java.io.*; import java.util.*; @@ -60,9 +59,6 @@ private static final String NULL_VALUE = "null"; // END PWC 6392327 - private static final String ANCIENT_DATE = - DateTool.formatOldCookie(new Date(10000)); - private MessageBytes name=MessageBytes.newInstance(); private MessageBytes value=MessageBytes.newInstance(); @@ -76,6 +72,18 @@ private boolean secure; // ;Secure private int version = 0; // ;Version=1 + // Other fields + private static final String OLD_COOKIE_PATTERN = + "EEE, dd-MMM-yyyy HH:mm:ss z"; + private static final DateFormat OLD_COOKIE_FORMAT; + private static final String ancientDate; + + static { + OLD_COOKIE_FORMAT = new SimpleDateFormat(OLD_COOKIE_PATTERN, Locale.US); + OLD_COOKIE_FORMAT.setTimeZone(TimeZone.getTimeZone("GMT")); + ancientDate = OLD_COOKIE_FORMAT.format(new Date(10000)); + } + //XXX CommentURL, Port -> use notes ? public ServerCookie() { @@ -336,13 +344,14 @@ // To expire we need to set the time back in future // ( pfrieden@dChain.com ) if (maxAge == 0) - buf.append( ANCIENT_DATE ); + buf.append( ancientDate ); else - DateTool.formatOldCookie - (new Date( System.currentTimeMillis() + + synchronized (OLD_COOKIE_FORMAT) { + OLD_COOKIE_FORMAT.format( + new Date( System.currentTimeMillis() + maxAge *1000L), buf, - new FieldPosition(0)); - + new FieldPosition(0)); + } } else { buf.append ("; Max-Age="); buf.append (maxAge);