--- old/src/java.base/share/classes/java/time/format/DateTimeFormatter.java 2016-02-25 18:40:41.226671501 +0300 +++ new/src/java.base/share/classes/java/time/format/DateTimeFormatter.java 2016-02-25 18:40:39.185671501 +0300 @@ -923,6 +923,7 @@ *
@@ -935,7 +936,9 @@ ISO_OFFSET_DATE_TIME = new DateTimeFormatterBuilder() .parseCaseInsensitive() .append(ISO_LOCAL_DATE_TIME) + .parseLenient() .appendOffsetId() + .parseStrict() .toFormatter(ResolverStyle.STRICT, IsoChronology.INSTANCE); } @@ -1160,6 +1163,7 @@ *
@@ -1178,7 +1182,9 @@ .appendValue(MONTH_OF_YEAR, 2) .appendValue(DAY_OF_MONTH, 2) .optionalStart() + .parseLenient() .appendOffset("+HHMMss", "Z") + .parseStrict() .toFormatter(ResolverStyle.STRICT, IsoChronology.INSTANCE); } --- old/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java 2016-02-25 18:40:42.497671501 +0300 +++ new/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java 2016-02-25 18:40:42.127671501 +0300 @@ -866,7 +866,9 @@ * Appends the zone offset, such as '+01:00', to the formatter. *
* This appends an instruction to format/parse the offset ID to the builder. - * This is equivalent to calling {@code appendOffset("+HH:MM:ss", "Z")}. + * This is equivalent to calling {@code appendOffset("+HH:mm:ss", "Z")}. + * See {@link #appendOffset(String, String)} for details on formatting + * and parsing. * * @return this, for chaining, not null */ @@ -886,9 +888,19 @@ * If the offset cannot be obtained then an exception is thrown unless the * section of the formatter is optional. *
- * During parsing, the offset is parsed using the format defined below. - * If the offset cannot be parsed then an exception is thrown unless the - * section of the formatter is optional. + * When parsing in strict mode, the input must contain the mandatory + * and optional elements are defined by the specified pattern. + * If the offset cannot be parsed then an exception is thrown unless + * the section of the formatter is optional. + *
+ * When parsing in lenient mode, only the hours are mandatory - minutes + * and seconds are optional. + * The colons are required if the specified pattern contains a colon. + * If the specified pattern is "+HH", the presence of colons is + * determined by whether the character after the hour digits is a colon + * or not. + * If the offset cannot be parsed then an exception is thrown unless + * the section of the formatter is optional. *
* The format of the offset is controlled by a pattern which must be one * of the following: @@ -902,6 +914,10 @@ *