feat!: migrate to Jackson 3 - #192
Merged
Merged
Conversation
Switches jackson-databind to the tools.jackson.core groupId at
${jackson.version} and updates the three extractors that use it.
Beyond the package rename:
- TokenStreamFactory is immutable in Jackson 3, so the StreamReadConstraints
hardening in HtmlExtractor and JsonExtractor now builds the factory up
front and passes it to the mapper instead of mutating it afterwards via
getFactory().setStreamReadConstraints(). The configured limits are
unchanged.
- JsonNode.fields() was removed; properties() replaces it. JsonExtractor
keeps iterating so its maxTextLength early exit still applies.
- JsonProcessingException is gone and JacksonException is unchecked, which
left JsonExtractor's catch (IOException) unreachable. It now catches
JacksonException and still raises ExtractException, so a malformed
document is reported exactly as before.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Moves
jackson-databindto thetools.jackson.coregroupId at${jackson.version}and updates the three extractors that use Jackson.Source changes
Jackson 3 is not only a package rename here -- three APIs this repository relies on changed shape:
TokenStreamFactoryis immutable.HtmlExtractorandJsonExtractorhardened their mappers by callingmapper.getFactory().setStreamReadConstraints(...)after construction, which Jackson 3 no longer allows. Both now build the factory first and pass it to the mapper:The configured limits (max nesting depth, max string length, max number length) are unchanged, so the protection against hostile input is identical.
JsonNode.fields()was removed, replaced byproperties().JsonExtractor.extractObjectkeeps iterating over anIteratorrather than switching toforEach, so itsmaxTextLengthearly exit still applies mid-object.JsonProcessingExceptionis gone and its replacementJacksonExceptionis unchecked, which leftJsonExtractor'scatch (IOException)unreachable. It now catchesJacksonExceptionand still raisesExtractException("Failed to parse JSON content", e), so a malformed document is reported exactly as before.HtmlExtractor's JSON-LD handler catchesJacksonExceptionahead of its existingcatch (RuntimeException).Verification
mvn test: 2097 tests, 0 failures, 0 errorsJsonExtractorTest(14),HtmlExtractorTest(55),PasswordBasedExtractorTest(18)Merge order
Requires codelibs/fess-parent (
jackson.version-> 3.2.1) to merge first.