Skip to content

Commit

Permalink
Datatype module support to make Jackson recognize Java 8 Date & Time (#…
Browse files Browse the repository at this point in the history
…551)

* Datatype module support to make Jackson recognize Java 8 Date & Time API data types (JSR-310)

* java version changing in ci/cd (8 -> 11)

* fix step's name

---------

Co-authored-by: GeyntsePV <[email protected]>
  • Loading branch information
pavelvic and GeyntsePV committed Nov 1, 2023
1 parent bdc093e commit 1743bb2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Set up JDK 1.8
uses: actions/setup-java@v1
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: 1.8
distribution: 'corretto'
java-version: 11

- name: Setup Android SDK
uses: android-actions/setup-android@v2
Expand Down
1 change: 1 addition & 0 deletions autobahn/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ dependencies {
implementation 'org.web3j:abi:4.6.0'
implementation 'org.web3j:utils:4.6.0'
implementation 'org.json:json:20210307'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.12.3'
}
if (IS_NETTY) {
implementation 'io.netty:netty-codec-http:4.1.63.Final'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.io.IOException;
Expand All @@ -32,6 +33,9 @@ public abstract class ISerializer {

public ISerializer(JsonFactory factor) {
mapper = new ObjectMapper(factor);
mapper.findAndRegisterModules();
mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
mapper.configure(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE, false);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
}

Expand Down

0 comments on commit 1743bb2

Please sign in to comment.