8138664: ZonedDateTime parse error for any date using 'GMT0' ZoneID - Java Bug System
Reviewed-by: rriggs, scolebourne, sherman
--- a/jdk/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java Tue Nov 10 14:11:50 2015 -0500
+++ b/jdk/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java Tue Nov 10 14:12:53 2015 -0500
@@ -3851,6 +3851,10 @@
return parseOffsetBased(context, text, position, position + 2, OffsetIdPrinterParser.INSTANCE_ID_ZERO);
} else if (context.charEquals(nextChar, 'G') && length >= position + 3 &&
context.charEquals(nextNextChar, 'M') && context.charEquals(text.charAt(position + 2), 'T')) {
+ if (length >= position + 4 && context.charEquals(text.charAt(position + 3), '0')) {
+ context.setParsed(ZoneId.of("GMT0"));
+ return position + 4;
+ }
return parseOffsetBased(context, text, position, position + 3, OffsetIdPrinterParser.INSTANCE_ID_ZERO);
}
}
--- a/jdk/test/java/time/tck/java/time/format/TCKZoneIdPrinterParser.java Tue Nov 10 14:11:50 2015 -0500
+++ b/jdk/test/java/time/tck/java/time/format/TCKZoneIdPrinterParser.java Tue Nov 10 14:12:53 2015 -0500
@@ -156,6 +156,7 @@
{"UTC", 3, -1, ZoneId.of("UTC"), false},
{"UT", 2, -1, ZoneId.of("UT"), false},
{"GMT", 3, -1, ZoneId.of("GMT"), false},
+ {"GMT0", 4, -1, ZoneId.of("GMT0"), false},
{"+00:00", 6, -1, ZoneOffset.UTC, true},
{"UTC+00:00", 9, -1, ZoneId.of("UTC"), false},