Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InvalidDefinitionException: Joda date/time type org.joda.time.DateTime not supported by default #292

Open
froque opened this issue Apr 27, 2021 · 1 comment

Comments

@froque
Copy link

froque commented Apr 27, 2021

Please use the following template to submit your issue. Following this template will allow us to quickly investigate and help you with your issue. Please be aware that issues which do not conform to this template may be closed.

For feature requests please contact us at [email protected]

Version info

  • intercom-java version: 2.8.1
  • Java version: 8

Expected behavior

Events with java.time or org.joda.time classes should not fail to send events.

Actual behavior

Jackson 2.12 refuses to serialize java.time or org.joda.time classes.

A workaround is to configure the Intercom ObjectMapper:

MapperSupport.objectMapper().registerModule(new JodaModule());

See: FasterXML/jackson-databind#2683, FasterXML/jackson-databind#2776

Steps to reproduce

  1. Use Jackson 2.12
  2. Use a Event with a org.joda.time.DateTime metadata
  3. send event to intercom

Logs

server_1  | Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Joda date/time type `org.joda.time.DateTime` not supported by default: add Module "com.fasterxml.jackson.datatype:jackson-datatype-joda" to enable handling (through reference chain: io.intercom.api.Event["metadata"]->java.util.HashMap["Valid from"])
server_1  | 	at com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:77)
server_1  | 	at com.fasterxml.jackson.databind.SerializerProvider.reportBadDefinition(SerializerProvider.java:1276)
server_1  | 	at com.fasterxml.jackson.databind.ser.impl.UnsupportedTypeSerializer.serialize(UnsupportedTypeSerializer.java:35)
server_1  | 	at com.fasterxml.jackson.databind.ser.std.MapSerializer.serializeFields(MapSerializer.java:808)
server_1  | 	at com.fasterxml.jackson.databind.ser.std.MapSerializer.serializeWithoutTypeInfo(MapSerializer.java:764)
server_1  | 	at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(MapSerializer.java:720)
server_1  | 	at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(MapSerializer.java:35)
server_1  | 	at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:728)
server_1  | 	at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:770)
server_1  | 	at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:178)
server_1  | 	at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider._serialize(DefaultSerializerProvider.java:480)
server_1  | 	at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:319)
server_1  | 	at com.fasterxml.jackson.databind.ObjectMapper._writeValueAndClose(ObjectMapper.java:4487)
server_1  | 	at com.fasterxml.jackson.databind.ObjectMapper.writeValue(ObjectMapper.java:3701)
server_1  | 	at io.intercom.api.HttpClient.prepareRequestEntity(HttpClient.java:135)
server_1  | 	at io.intercom.api.HttpClient.executeHttpMethod(HttpClient.java:108)
server_1  | 	... 8 common frames omitted
@cies
Copy link

cies commented Jun 6, 2024

Maybe intercom-java should allow (in addition to the default) one to pass your own Jackson dataMapper. This may also have allowed us to fix #311 ourselves instead of waiting for Intercom devs to work on these issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants