@@ -176,21 +176,22 @@ public void testDateISO8601_customTZ() throws IOException
176
176
/**
177
177
* Configure the StdDateFormat to serialize TZ offset with a colon between hours and minutes
178
178
*
179
- * See [databind#1744]
179
+ * See [databind#1744], [databind#2643]
180
180
*/
181
181
public void testDateISO8601_colonInTZ () throws IOException
182
182
{
183
+ // with [databind#2643], default now is to include
183
184
StdDateFormat dateFormat = new StdDateFormat ();
184
- assertFalse (dateFormat .isColonIncludedInTimeZone ());
185
- dateFormat = dateFormat .withColonInTimeZone (true );
186
185
assertTrue (dateFormat .isColonIncludedInTimeZone ());
186
+ // but we can disable it
187
+ dateFormat = dateFormat .withColonInTimeZone (false );
187
188
188
189
ObjectMapper mapper = new ObjectMapper ();
189
190
mapper .configure (SerializationFeature .WRITE_DATES_AS_TIMESTAMPS , false );
190
191
mapper .setDateFormat (dateFormat );
191
192
192
- serialize ( mapper , judate (1970 , 1 , 1 , 02 , 00 , 00 , 0 , "GMT+2" ), "1970-01-01T00:00:00.000+00:00 " );
193
- serialize ( mapper , judate (1970 , 1 , 1 , 00 , 00 , 00 , 0 , "UTC" ), "1970-01-01T00:00:00.000+00:00 " );
193
+ serialize (mapper , judate (1970 , 1 , 1 , 02 , 00 , 00 , 0 , "GMT+2" ), "1970-01-01T00:00:00.000+0000 " );
194
+ serialize (mapper , judate (1970 , 1 , 1 , 00 , 00 , 00 , 0 , "UTC" ), "1970-01-01T00:00:00.000+0000 " );
194
195
}
195
196
196
197
public void testDateOther () throws IOException
@@ -384,7 +385,7 @@ private void serialize(ObjectWriter w, Object date, String expected) throws IOEx
384
385
385
386
private String zoneOffset (String raw ) {
386
387
// Add colon or not -- difference between 2.10 and earlier, 2.11 and later
387
- // return raw.substring(0, 2) + ":" + raw.substring(2); // 2.11 and later
388
- return raw ; // 2.10 and earlier
388
+ return raw .substring (0 , 2 ) + ":" + raw .substring (2 ); // 2.11 and later
389
+ // return raw; // 2.10 and earlier
389
390
}
390
391
}
0 commit comments