From 39785388b05ed0ac447860d96015fce359f1ada6 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Sat, 10 Jun 2017 20:48:03 -0700 Subject: [PATCH] Fix #1651 --- release-notes/CREDITS | 2 ++ release-notes/VERSION | 2 ++ .../fasterxml/jackson/databind/util/StdDateFormat.java | 10 ++++++++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/release-notes/CREDITS b/release-notes/CREDITS index 3255ba4ab0..67537ccb94 100644 --- a/release-notes/CREDITS +++ b/release-notes/CREDITS @@ -626,6 +626,8 @@ Slobodan Pejic (slobo-showbie@github) Bertrand Renuart (brenuart@github) * Reported #1648: `DateTimeSerializerBase` ignores configured date format when creating contextual (2.8.9) + * Reported #1651: `StdDateFormat` fails to parse 'zulu' date when TimeZone other than UTC + (2.8.9) Connor Kuhn (ckuhn@github) * Contributed #1341: FAIL_ON_MISSING_EXTERNAL_TYPE_ID_PROPERTY diff --git a/release-notes/VERSION b/release-notes/VERSION index 30498a1810..16ecd5a7c6 100644 --- a/release-notes/VERSION +++ b/release-notes/VERSION @@ -18,6 +18,8 @@ Project: jackson-databind (reported by Slobodan P) #1648: `DateTimeSerializerBase` ignores configured date format when creating contextual (reported by Bertrand R) +#1651: `StdDateFormat` fails to parse 'zulu' date when TimeZone other than UTC + (reported by Bertrand R) 2.8.8.1 (19-Apr-2017) diff --git a/src/main/java/com/fasterxml/jackson/databind/util/StdDateFormat.java b/src/main/java/com/fasterxml/jackson/databind/util/StdDateFormat.java index 8bc792130e..3faefb93f5 100644 --- a/src/main/java/com/fasterxml/jackson/databind/util/StdDateFormat.java +++ b/src/main/java/com/fasterxml/jackson/databind/util/StdDateFormat.java @@ -447,8 +447,11 @@ protected Date parseAsISO8601(String dateStr, ParsePosition pos, boolean throwEr df = _formatISO8601_z; formatStr = DATE_FORMAT_STR_ISO8601_Z; if (df == null) { + // 10-Jun-2017, tatu: As per [databind#1651], when using this format, + // must use UTC, not whatever is configured as default timezone + // (because we know `Z` identifier is used) df = _formatISO8601_z = _cloneFormat(DATE_FORMAT_ISO8601_Z, formatStr, - _timezone, _locale, _lenient); + DEFAULT_TIMEZONE, _locale, _lenient); } // may be missing milliseconds... if so, add if (dateStr.charAt(len-4) == ':') { @@ -520,8 +523,11 @@ protected Date parseAsISO8601(String dateStr, ParsePosition pos, boolean throwEr df = _formatISO8601_z; formatStr = DATE_FORMAT_STR_ISO8601_Z; if (df == null) { + // 10-Jun-2017, tatu: As per [databind#1651], when using this format, + // must use UTC, not whatever is configured as default timezone + // (because we know `Z` identifier is used) df = _formatISO8601_z = _cloneFormat(DATE_FORMAT_ISO8601_Z, formatStr, - _timezone, _locale, _lenient); + DEFAULT_TIMEZONE, _locale, _lenient); } } }