jericho 01/02/27 18:48:14
Modified: src/webdav/client/src/org/apache/webdav/lib Cookie.java
Log:
- Date and time specification is English.
Don't follow the default system locale.
Revision Changes Path
1.8 +15 -10
jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/Cookie.java
Index: Cookie.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/Cookie.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Cookie.java 2001/02/26 14:02:09 1.7
+++ Cookie.java 2001/02/28 02:48:14 1.8
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/Cookie.java,v 1.7
2001/02/26 14:02:09 jericho Exp $
- * $Revision: 1.7 $
- * $Date: 2001/02/26 14:02:09 $
+ * $Header:
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/Cookie.java,v 1.8
2001/02/28 02:48:14 jericho Exp $
+ * $Revision: 1.8 $
+ * $Date: 2001/02/28 02:48:14 $
*
* ====================================================================
*
@@ -67,8 +67,10 @@
import java.util.Date;
import java.util.Enumeration;
import java.util.Vector;
+import java.util.Locale;
+import java.text.DateFormat;
import java.text.SimpleDateFormat;
-import java.text.ParsePosition;
+import java.text.ParseException;
/**
* This class represents an http cookie as specified in RFC 2109.
@@ -418,12 +420,15 @@
* the Expires date format is "Wdy, DD-Mon-YY HH:MM:SS GMT".
* There might be one more? Wdy, DD-Mon-YYYY HH:MM:SS GMT
*/
- SimpleDateFormat formatter
- = new SimpleDateFormat ("EEE, dd-MMM-yyyy HH:mm:ss z");
- String expiryDate = parameters[j].getValue();
- ParsePosition pos = new ParsePosition(0);
- Date date = formatter.parse(expiryDate, pos);
- cookie.setExpiryDate(date);
+ try {
+ // RFC 1123, 822, Date and time specification is English.
+ DateFormat formatter = new SimpleDateFormat
+ ("EEE, dd-MMM-yyyy HH:mm:ss z", Locale.US);
+ String expiryDate = parameters[j].getValue();
+ Date date = formatter.parse(expiryDate);
+ cookie.setExpiryDate(date);
+ } catch (ParseException e) {
+ }
}
}