-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Milestone
Description
During serialization I've got the following error:
Caused by: java.lang.NullPointerException
at com.fasterxml.jackson.databind.ser.std.SqlDateSerializer.serialize(SqlDateSerializer.java:48) [jackson-databind-2.5.2.jar:2.5.2]
at com.fasterxml.jackson.databind.ser.std.SqlDateSerializer.serialize(SqlDateSerializer.java:18) [jackson-databind-2.5.2.jar:2.5.2]
It is thrown from the method:
public void serialize(java.sql.Date value, JsonGenerator jgen, SerializerProvider provider)
throws IOException, JsonGenerationException
{
if (_useTimestamp) {
jgen.writeNumber(_timestamp(value));
} else {
jgen.writeString(value.toString());
}
}
because the _useTimestamp
is null
It set in DateTimeSerializerBase#createContextual by the framgment (asNumber is null):
Boolean asNumber = (format.getShape() == JsonFormat.Shape.STRING) ? Boolean.FALSE : null;
// If not, do we have a pattern?
TimeZone tz = format.getTimeZone();
if (format.hasPattern()) {
String pattern = format.getPattern();
final Locale loc = format.hasLocale() ? format.getLocale() : prov.getLocale();
SimpleDateFormat df = new SimpleDateFormat(pattern, loc);
if (tz == null) {
tz = prov.getTimeZone();
}
df.setTimeZone(tz);
return withFormat(asNumber, df);
}
Metadata
Metadata
Assignees
Labels
No labels