am d421995f: Fix parsing of HTTP Date years.

Merge commit 'd421995fdb490c687d27b56aa89bc83afc7c3d06' into eclair-plus-aosp

* commit 'd421995fdb490c687d27b56aa89bc83afc7c3d06':
  Fix parsing of HTTP Date years.
This commit is contained in:
Ben Murdoch
2009-09-24 04:28:13 -07:00
committed by Android Git Automerger

View File

@@ -184,11 +184,20 @@ public final class HttpDateTime {
} else {
return year + 2000;
}
} else
return (yearString.charAt(0) - '0') * 1000
} else if (yearString.length() == 3) {
// According to RFC 2822, three digit years should be added to 1900.
int year = (yearString.charAt(0) - '0') * 100
+ (yearString.charAt(1) - '0') * 10
+ (yearString.charAt(2) - '0');
return year + 1900;
} else if (yearString.length() == 4) {
return (yearString.charAt(0) - '0') * 1000
+ (yearString.charAt(1) - '0') * 100
+ (yearString.charAt(2) - '0') * 10
+ (yearString.charAt(3) - '0');
} else {
return 1970;
}
}
private static TimeOfDay getTime(String timeString) {