1091 sb.append(";$Port=\"").append(getPortlist()).append('"'); |
1091 sb.append(";$Port=\"").append(getPortlist()).append('"'); |
1092 |
1092 |
1093 return sb.toString(); |
1093 return sb.toString(); |
1094 } |
1094 } |
1095 |
1095 |
1096 private static SimpleDateFormat[] cDateFormats = null; |
1096 static final TimeZone GMT = TimeZone.getTimeZone("GMT"); |
1097 static { |
1097 |
1098 cDateFormats = new SimpleDateFormat[COOKIE_DATE_FORMATS.length]; |
|
1099 for (int i = 0; i < COOKIE_DATE_FORMATS.length; i++) { |
|
1100 cDateFormats[i] = new SimpleDateFormat(COOKIE_DATE_FORMATS[i], Locale.US); |
|
1101 cDateFormats[i].setTimeZone(TimeZone.getTimeZone("GMT")); |
|
1102 } |
|
1103 } |
|
1104 /* |
1098 /* |
1105 * @param dateString a date string in one of the formats |
1099 * @param dateString a date string in one of the formats |
1106 * defined in Netscape cookie spec |
1100 * defined in Netscape cookie spec |
1107 * |
1101 * |
1108 * @return delta seconds between this cookie's creation |
1102 * @return delta seconds between this cookie's creation |
1109 * time and the time specified by dateString |
1103 * time and the time specified by dateString |
1110 */ |
1104 */ |
1111 private long expiryDate2DeltaSeconds(String dateString) { |
1105 private long expiryDate2DeltaSeconds(String dateString) { |
1112 for (SimpleDateFormat df : cDateFormats) { |
1106 for (int i = 0; i < COOKIE_DATE_FORMATS.length; i++) { |
|
1107 SimpleDateFormat df = new SimpleDateFormat(COOKIE_DATE_FORMATS[i], Locale.US); |
|
1108 df.setTimeZone(GMT); |
1113 try { |
1109 try { |
1114 Date date = df.parse(dateString); |
1110 Date date = df.parse(dateString); |
1115 return (date.getTime() - whenCreated) / 1000; |
1111 return (date.getTime() - whenCreated) / 1000; |
1116 } catch (Exception e) { |
1112 } catch (Exception e) { |
1117 |
1113 // Ignore, try the next date format |
1118 } |
1114 } |
1119 } |
1115 } |
1120 return 0; |
1116 return 0; |
1121 } |
1117 } |
1122 |
1118 |