Skip to content

Commit 3a7a417

Browse files
committed
backport #423 in 2.3
1 parent e6e15a5 commit 3a7a417

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

release-notes/VERSION

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ Version: 2.3.3 (xx-xxx-2014)
33

44
#420: Remove 'final' modifier from `BeanDeserializerBase.deserializeWithType`
55
(requested by Ghoughpteighbteau@github)
6+
#423: Fix `CalendarSerializer` to work with custom format
7+
(repored by sergeymetallic@github)
68

79
------------------------------------------------------------------------
810
=== History: ===

src/main/java/com/fasterxml/jackson/databind/ser/std/CalendarSerializer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public void serialize(Calendar value, JsonGenerator jgen, SerializerProvider pro
4949
} else if (_customFormat != null) {
5050
// 21-Feb-2011, tatu: not optimal, but better than alternatives:
5151
synchronized (_customFormat) {
52-
jgen.writeString(_customFormat.format(value));
52+
jgen.writeString(_customFormat.format(value.getTime()));
5353
}
5454
} else {
5555
provider.defaultSerializeDateValue(value.getTime(), jgen);

src/test/java/com/fasterxml/jackson/databind/ser/TestDateSerialization.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public void testDateWithJsonFormat() throws Exception
158158

159159
// and for [Issue#423] as well:
160160
json = mapper.writer().with(getUTCTimeZone()).writeValueAsString(new CalendarAsStringBean(0L));
161-
assertEquals("{\"date\":\"1970-01-01\"}", json);
161+
assertEquals("{\"value\":\"1970-01-01\"}", json);
162162
}
163163

164164
/**

0 commit comments

Comments
 (0)