hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Colin Taylor <colin.tay...@gmail.com>
Subject Re: cookies of the future and SimpleDateFormat
Date Thu, 23 Dec 2004 00:43:28 GMT
Thank you for  your prompt reply Oleg.

Yes, your solutions doable though rather a lot of working considering
the offending parseDate method is private and the SimpleDateFormats
only exist in a local loop, meaning I have to duplicate a lot of code
unnecessarily.

I disagree with you on the date assumption, after all the code is
assuming the date is in the past! So surely the code should just be
making the more logical assumption that a cookie being sent in the
21st century is for the 21st century!

Furthermore the fact is this date comparison  is being done a field
marked "Expires" which only increases the chance of it being this
century. Whether or not the set of date formats used are used for
other date comparisons is tangential to the issue because the code
should follow the principle of least surprise.

cheers
Colin.

ps.
To change the assumption all thats needed is to pass in a
two_year_start to DateUtil.parseDate()   which should be "20" in the
expires field check IMHO. This wouldnt affect any fully specified
years and any other users of the field can use  "19" if so desired.

from

if (dateParser == null) {
 dateParser = new SimpleDateFormat(format, Locale.US);
 dateParser.setTimeZone(TimeZone.getTimeZone("GMT"));
}

to

if (dateParser == null) {
 dateParser = new SimpleDateFormat(format, Locale.US);
 dateParser.setTimeZone(TimeZone.getTimeZone("GMT"));
 dateParser.setTwoDigitYearStart(two_year_start));   // new

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


Mime
View raw message