changeset 13046:de39f994d657

8138664: ZonedDateTime parse error for any date using 'GMT0' ZoneID - Java Bug System Reviewed-by: rriggs, scolebourne, sherman
author ntv
date Tue, 10 Nov 2015 14:12:53 -0500
parents 4db62628d88c
children fce133de963b
files src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java test/java/time/tck/java/time/format/TCKZoneIdPrinterParser.java
diffstat 2 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java	Tue Nov 10 14:11:50 2015 -0500
+++ b/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/test/java/time/tck/java/time/format/TCKZoneIdPrinterParser.java	Tue Nov 10 14:11:50 2015 -0500
+++ b/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},