Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 2 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ jobs:
strategy:
fail-fast: false
matrix:
jacksonVersion: [ "2.6.7.5", "2.7.9", "2.8.11", "2.9.10", "2.10.5", "2.11.4", "2.12.7", "2.13.5", "2.14.3", "2.15.2" ]
jacksonVersion: [ "2.15.3" ]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up OpenJDK 8
uses: actions/setup-java@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
hash-master: ${{ steps.hash-master.outputs.hash-master }}
hash-main: ${{ steps.hash-main.outputs.hash-main }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- id: hash-master
Expand All @@ -30,7 +30,7 @@ jobs:
if: needs.diff.outputs.hash-master != needs.diff.outputs.hash-main
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout master
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: true
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up OpenJDK 8
uses: actions/setup-java@v3
with:
Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {

ext {
if (!project.hasProperty("jacksonVersionForJacksonTest")) {
jacksonVersionForJacksonTest = "2.6.7.5"
jacksonVersionForJacksonTest = "2.15.3"
}
}

Expand Down Expand Up @@ -62,7 +62,7 @@ dependencies {

// Dependencies should be "api" so that their scope would be "compile" in "pom.xml".
api "javax.validation:validation-api:1.1.0.Final"
api platform("com.fasterxml.jackson:jackson-bom:2.6.7.5")
api platform("com.fasterxml.jackson:jackson-bom:2.15.3")
api "com.fasterxml.jackson.core:jackson-annotations"
api "com.fasterxml.jackson.core:jackson-core"
api "com.fasterxml.jackson.core:jackson-databind"
Expand Down Expand Up @@ -186,7 +186,7 @@ publishing {
developers {
developer {
name = "Dai MIKURUBE"
email = "dmikurube@treasure-data.com"
email = "dmikurube@acm.org"
}
}

Expand Down
10 changes: 5 additions & 5 deletions gradle.lockfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# This is a Gradle generated file for dependency locking.
# Manual edits can break the build and are not advised.
# This file is expected to be part of source control.
com.fasterxml.jackson.core:jackson-annotations:2.6.7=compileClasspath,runtimeClasspath
com.fasterxml.jackson.core:jackson-core:2.6.7=compileClasspath,runtimeClasspath
com.fasterxml.jackson.core:jackson-databind:2.6.7.5=compileClasspath,runtimeClasspath
com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.6.7=compileClasspath,runtimeClasspath
com.fasterxml.jackson:jackson-bom:2.6.7.5=compileClasspath,runtimeClasspath
com.fasterxml.jackson.core:jackson-annotations:2.15.3=compileClasspath,runtimeClasspath
com.fasterxml.jackson.core:jackson-core:2.15.3=compileClasspath,runtimeClasspath
com.fasterxml.jackson.core:jackson-databind:2.15.3=compileClasspath,runtimeClasspath
com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.15.3=compileClasspath,runtimeClasspath
com.fasterxml.jackson:jackson-bom:2.15.3=compileClasspath,runtimeClasspath
javax.validation:validation-api:1.1.0.Final=compileClasspath,runtimeClasspath
org.embulk:embulk-spi:0.11=compileClasspath
org.msgpack:msgpack-core:0.8.24=compileClasspath
Expand Down
36 changes: 36 additions & 0 deletions src/main/java/org/embulk/util/config/ConfigMapperFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ public Builder withValidator(final Validator validator) {
* Creates a {@link Builder} to build {@link ConfigMapperFactory}.
*/
public static Builder builder() {
assertJacksonCoreVersion();
assertJacksonDataBindVersion();
assertJacksonDataTypeJdk8Version();
return new Builder();
}

Expand Down Expand Up @@ -320,6 +323,39 @@ private ObjectMapper mapperForOthers() {
return objectMapper;
}

private static void assertJacksonCoreVersion() {
if (com.fasterxml.jackson.core.json.PackageVersion.VERSION.getMajorVersion() != 2) {
throw new UnsupportedOperationException("embulk-util-config is not used with Jackson 2.");
}

final int minor = com.fasterxml.jackson.core.json.PackageVersion.VERSION.getMinorVersion();
if (minor < 14 || (minor == 15 && com.fasterxml.jackson.core.json.PackageVersion.VERSION.getPatchLevel() <= 2)) {
throw new UnsupportedOperationException("embulk-util-config is not used with Jackson 2.15.3 or later.");
}
}

private static void assertJacksonDataBindVersion() {
if (com.fasterxml.jackson.databind.cfg.PackageVersion.VERSION.getMajorVersion() != 2) {
throw new UnsupportedOperationException("embulk-util-config is not used with Jackson 2.");
Copy link
Member

Choose a reason for hiding this comment

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

I've missed point out this part.

Please create another PR when this change useful.
embulk-util-config is not used with Jackson(jackson-databind) 2.

Copy link
Member Author

Choose a reason for hiding this comment

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

I basically don't think it's needed for this part.

Jackson 1 had different Java package names (org.codehaus.jackson.*) and Jackson 3 is going to have yet another Java package names (tools.jackson.*). While using Jackson 2 (com.fasterxml.jackson.*), the major version should be always 2.

This part is practically just an assertion. When it happens, that's not a simple problem anyway. ;)

Copy link
Member

Choose a reason for hiding this comment

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

I got it. Thanks! LGTM👍

}

final int minor = com.fasterxml.jackson.databind.cfg.PackageVersion.VERSION.getMinorVersion();
if (minor < 14 || (minor == 15 && com.fasterxml.jackson.databind.cfg.PackageVersion.VERSION.getPatchLevel() <= 2)) {
throw new UnsupportedOperationException("embulk-util-config is not used with Jackson 2.15.3 or later.");
Copy link
Member

@hiroyuki-sato hiroyuki-sato Oct 25, 2023

Choose a reason for hiding this comment

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

What do you think about adding databind in the log message?
I'm wondering that line 333 and here use the same error message.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks! Sounds reasonable. Fixed it like "embulk-util-config is not used with Jackson (jackson-databind) 2.15.3 or later."

}
}

private static void assertJacksonDataTypeJdk8Version() {
if (com.fasterxml.jackson.datatype.jdk8.PackageVersion.VERSION.getMajorVersion() != 2) {
throw new UnsupportedOperationException("embulk-util-config is not used with Jackson 2.");
}

final int minor = com.fasterxml.jackson.datatype.jdk8.PackageVersion.VERSION.getMinorVersion();
if (minor < 14 || (minor == 15 && com.fasterxml.jackson.datatype.jdk8.PackageVersion.VERSION.getPatchLevel() <= 2)) {
throw new UnsupportedOperationException("embulk-util-config is not used with Jackson 2.15.3 or later.");
Copy link
Member

Choose a reason for hiding this comment

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

ditto

}
}

private static final Logger logger = LoggerFactory.getLogger(ConfigMapperFactory.class);

private final List<Module> additionalModules;
Expand Down