Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.
This repository was archived by the owner on Dec 4, 2023. It is now read-only.

com.microsoft.bot.schema.Serialization ObjectMapper is unable to serialize Java8 Date/Time with newest jackson. #1454

@kreigiron

Description

@kreigiron

Is your feature request related to a problem? Please describe.
Problem: newer Jackson libraries (e.g. v 2.12.x) are unable to deserialize Java 8 time and date objects because a JDK8 Module is not added in ObjectMapper at com.microsoft.bot.schema.Serialization, that ObjectMapper is tightly coupled and as a client of the library we're unable to add additional modules in order to avoid this issue,

On jackson 2.12 the serialization throws a

Specific warnings thrown by jackson libs <2.12

WARNING: An illegal reflective access operation has occurred

WARNING: Illegal reflective access by com.fasterxml.jackson.databind.util.ClassUtil (jar:file:/{ommited}!/BOOT-INF/lib/jackson-databind-2.11.3.jar!/) to field java.time.OffsetDateTime.offset
WARNING: Please consider reporting this to the maintainers of com.fasterxml.jackson.databind.util.ClassUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
 

Describe the solution you'd like
Register the modules into the object mapper with


objectMapper.registerModule(new Jdk8Module());
objectMapper.registerModule(new JavaTimeModule());
``
by either:
* Register these modules into com.microsoft.bot.schema.Serialization by the sdk
* exposing the objectmapper and allow sdk users to add the modules by their own by .

**Describe alternatives you've considered**
See above

**Additional context**
Tested with the following versions:
JDK: adoptopenddk 13 from public docker image adoptopenjdk/openjdk13:alpine-jre
Spring Version: 2.4.0
Jackson libraries: 2.11.3, 2.12.6. 2.13.1
bot-integration-spring && bot-dialogs: 4.14.1
Related stackoverflow: https://stackoverflow.com/questions/27952472/serialize-deserialize-java-8-java-time-with-jackson-json-mapper

Metadata

Metadata

Assignees

Labels

Bot ServicesRequired for internal Azure reporting. Do not delete. Do not change color.customer-reportedIssue is created by anyone that is not a collaborator in the repository.feature-requestA request for new functionality or an enhancement to an existing one.needs-triageThe issue has just been created and it has not been reviewed by the team.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions