Android's SimpleDateFormat doesn't support XXX at any API

This commit is contained in:
str4d
2015-06-06 09:24:46 +00:00
parent 663ccb72d7
commit 7c13fb2ba0
2 changed files with 6 additions and 2 deletions

View File

@ -29,7 +29,8 @@ public abstract class RFC3339Date {
private static final String TZF1, TZF2; private static final String TZF1, TZF2;
static { static {
if (SystemVersion.isJava7()) { // Android's SimpleDateFormat doesn't support XXX at any API
if (SystemVersion.isJava7() && !SystemVersion.isAndroid()) {
// ISO 8601 // ISO 8601
// These handle timezones like +1000, +10, and +10:00 // These handle timezones like +1000, +10, and +10:00
TZF1 = "yyyy-MM-dd'T'HH:mm:ssXXX"; TZF1 = "yyyy-MM-dd'T'HH:mm:ssXXX";
@ -81,7 +82,7 @@ public abstract class RFC3339Date {
// strip the ':' out of the time zone, if present, // strip the ':' out of the time zone, if present,
// for Java 6 where we don't have the 'X' format // for Java 6 where we don't have the 'X' format
int len = s.length(); int len = s.length();
if (!SystemVersion.isJava7() && if ((!SystemVersion.isJava7() || SystemVersion.isAndroid()) &&
s.charAt(len - 1) != 'Z' && s.charAt(len - 1) != 'Z' &&
s.charAt(len - 3) == ':' && s.charAt(len - 3) == ':' &&
(s.charAt(len - 6) == '+' || s.charAt(len - 6) == '-')) { (s.charAt(len - 6) == '+' || s.charAt(len - 6) == '-')) {

View File

@ -1,3 +1,6 @@
2015-06-06 str4d
* newsxml: Don't use XXX for parsing dates on Android
2015-06-04 str4d 2015-06-04 str4d
* i2ptunnel: * i2ptunnel:
- Don't connect manager to router in constructor (ticket #815) - Don't connect manager to router in constructor (ticket #815)