-
Notifications
You must be signed in to change notification settings - Fork 1
Bump the depended Jackson version to 2.15.3 #58
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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(); | ||
} | ||
|
||
|
@@ -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."); | ||
} | ||
|
||
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."); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do you think about adding There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks! Sounds reasonable. Fixed it like |
||
} | ||
} | ||
|
||
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."); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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. ;)
There was a problem hiding this comment.
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👍