}
// N.B. this must agree with the save() and cookieToString() methods
String line;
try {
final CollectionProperty cookies = getCookies();
while ((line = reader.readLine()) != null) {
try {
if (line.startsWith("#") || line.trim().length() == 0) {//$NON-NLS-1$
continue;
}
String[] st = JOrphanUtils.split(line, TAB, false);
final int _domain = 0;
//final int _ignored = 1;
final int _path = 2;
final int _secure = 3;
final int _expires = 4;
final int _name = 5;
final int _value = 6;
final int _fields = 7;
if (st.length!=_fields) {
throw new IOException("Expected "+_fields+" fields, found "+st.length+" in "+line);
}
if (st[_path].length()==0) {
st[_path] = "/"; //$NON-NLS-1$
}
boolean secure = Boolean.valueOf(st[_secure]).booleanValue();
long expires = Long.valueOf(st[_expires]).longValue();
if (expires==Long.MAX_VALUE) {
expires=0;
}
//long max was used to represent a non-expiring cookie, but that caused problems
Cookie cookie = new Cookie(st[_name], st[_value], st[_domain], st[_path], secure, expires);
cookies.addItem(cookie);
} catch (NumberFormatException e) {
throw new IOException("Error parsing cookie line\n\t'" + line + "'\n\t" + e);
}
}
} finally {