From e361cf1bbd219b7f947ea0ea63bd47ff6e68e1a4 Mon Sep 17 00:00:00 2001 From: GeyntsePV Date: Mon, 9 Oct 2023 20:23:03 +0300 Subject: [PATCH 1/3] Datatype module support to make Jackson recognize Java 8 Date & Time API data types (JSR-310) --- autobahn/build.gradle | 1 + .../io/crossbar/autobahn/wamp/interfaces/ISerializer.java | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/autobahn/build.gradle b/autobahn/build.gradle index 8b375122..1a4f2982 100644 --- a/autobahn/build.gradle +++ b/autobahn/build.gradle @@ -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' diff --git a/autobahn/src/main/java/io/crossbar/autobahn/wamp/interfaces/ISerializer.java b/autobahn/src/main/java/io/crossbar/autobahn/wamp/interfaces/ISerializer.java index 2651c140..88dd6d83 100644 --- a/autobahn/src/main/java/io/crossbar/autobahn/wamp/interfaces/ISerializer.java +++ b/autobahn/src/main/java/io/crossbar/autobahn/wamp/interfaces/ISerializer.java @@ -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; @@ -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); } From 8c52761121236a307b4704ca8baf432acd76e156 Mon Sep 17 00:00:00 2001 From: GeyntsePV Date: Wed, 18 Oct 2023 21:11:12 +0300 Subject: [PATCH 2/3] java version changing in ci/cd (8 -> 11) --- .github/workflows/main.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b0700a45..e3f440ff 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,9 +15,10 @@ jobs: - uses: actions/checkout@v2 - name: Set up JDK 1.8 - uses: actions/setup-java@v1 + 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 From aa53c161dee9f11e543f89699cc121c8c66dd52c Mon Sep 17 00:00:00 2001 From: GeyntsePV Date: Wed, 18 Oct 2023 21:21:59 +0300 Subject: [PATCH 3/3] fix step's name --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e3f440ff..c41b9b31 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,7 +14,7 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set up JDK 1.8 + - name: Set up JDK 11 uses: actions/setup-java@v3 with: distribution: 'corretto'