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

Restore joda deserialization #1836

Merged
merged 2 commits into from
Dec 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions changelog/@unreleased/pr-1836.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type: fix
fix:
description: 'conjure-java-jackson-serialization: joda types can once again be deserialized
(as this was a behaviour change of the jackson 2.12 upgrade which landed in conjure-java-runtime
6.9.0)'
links:
- https://github.com/palantir/conjure-java-runtime/pull/1836
1 change: 1 addition & 0 deletions conjure-java-jackson-serialization/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dependencies {
compile "com.fasterxml.jackson.dataformat:jackson-dataformat-cbor"
compile "com.palantir.safe-logging:preconditions"

implementation "com.fasterxml.jackson.datatype:jackson-datatype-joda"
implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-smile"

testCompile "junit:junit"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.fasterxml.jackson.dataformat.smile.SmileFactory;
import com.fasterxml.jackson.datatype.guava.GuavaModule;
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
import com.fasterxml.jackson.datatype.joda.JodaModule;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.fasterxml.jackson.module.afterburner.AfterburnerModule;

Expand Down Expand Up @@ -116,7 +117,7 @@ public static ObjectMapper newSmileServerObjectMapper() {
/**
* Configures provided ObjectMapper with default modules and settings.
*
* <p>Modules: Guava, JDK7, JDK8, Afterburner, JavaTime
* <p>Modules: Guava, JDK7, JDK8, Afterburner, JavaTime, Joda
*
* <p>Settings:
*
Expand All @@ -134,6 +135,9 @@ public static ObjectMapper withDefaultModules(ObjectMapper mapper) {
.registerModule(new AfterburnerModule())
.registerModule(new JavaTimeModule())
.registerModule(new LenientLongModule())
// we strongly recommend using built-in java.time classes instead of joda ones. Joda deserialization
// was implicit up until jackson 2.12
.registerModule(new JodaModule())
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.disable(SerializationFeature.WRITE_DURATIONS_AS_TIMESTAMPS)
.disable(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE)
Expand Down
4 changes: 2 additions & 2 deletions versions.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:2.12.0 (3 constraints:
com.fasterxml.jackson.dataformat:jackson-dataformat-smile:2.12.0 (2 constraints: eb13f681)
com.fasterxml.jackson.datatype:jackson-datatype-guava:2.12.0 (3 constraints: 9822ec24)
com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.12.0 (4 constraints: 662fc249)
com.fasterxml.jackson.datatype:jackson-datatype-joda:2.12.0 (3 constraints: 9822ec24)
com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.12.0 (3 constraints: 9822ec24)
com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:2.12.0 (3 constraints: 873df046)
com.fasterxml.jackson.jaxrs:jackson-jaxrs-cbor-provider:2.12.0 (2 constraints: eb13f681)
Expand Down Expand Up @@ -65,6 +66,7 @@ jakarta.el:jakarta.el-api:3.0.3 (1 constraints: fe135465)
jakarta.validation:jakarta.validation-api:2.0.2 (3 constraints: 8e372576)
jakarta.ws.rs:jakarta.ws.rs-api:2.1.6 (12 constraints: 4cd52d0a)
jakarta.xml.bind:jakarta.xml.bind-api:2.3.2 (1 constraints: 30198ba6)
joda-time:joda-time:2.10.8 (2 constraints: b4238380)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a huge fan of including joda in cjr, but I don't want to regress folks

Copy link
Contributor Author

@iamdanfox iamdanfox Dec 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed - if we were being more brutal I think we should just wait for the P0s and then ask people to manually add the dep, but I think this would be too mean :/

org.apache.httpcomponents.client5:httpclient5:5.0.3 (1 constraints: cc13926e)
org.apache.httpcomponents.core5:httpcore5:5.0.3 (3 constraints: 5b395b0c)
org.apache.httpcomponents.core5:httpcore5-h2:5.0.2 (1 constraints: 3b13053c)
Expand Down Expand Up @@ -97,7 +99,6 @@ ch.qos.logback:logback-access:1.2.3 (1 constraints: b41148e2)
ch.qos.logback:logback-classic:1.2.3 (4 constraints: d232d9c3)
ch.qos.logback:logback-core:1.2.3 (3 constraints: 1a28577f)
com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.12.0 (3 constraints: 2725720c)
com.fasterxml.jackson.datatype:jackson-datatype-joda:2.12.0 (2 constraints: 621dab2e)
com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.12.0 (2 constraints: 0b1d0410)
com.fasterxml.jackson.module:jackson-module-parameter-names:2.12.0 (2 constraints: 621dab2e)
com.google.code.findbugs:annotations:3.0.1 (1 constraints: 9e0aafc3)
Expand Down Expand Up @@ -136,7 +137,6 @@ jakarta.servlet:jakarta.servlet-api:4.0.3 (1 constraints: 0c1a5fe4)
javax.activation:javax.activation-api:1.2.0 (2 constraints: 6a18eec3)
javax.servlet:javax.servlet-api:3.1.0 (1 constraints: 830dcc28)
javax.xml.bind:jaxb-api:2.3.1 (1 constraints: 290e1140)
joda-time:joda-time:2.10.8 (2 constraints: b4238380)
junit:junit:4.13.1 (5 constraints: 1f60ae57)
net.bytebuddy:byte-buddy:1.10.18 (1 constraints: 750ba8e9)
net.bytebuddy:byte-buddy-agent:1.10.18 (1 constraints: 750ba8e9)
Expand Down