Skip to content

feat!: migrate to Jackson 3 - #192

Merged
marevol merged 1 commit into
masterfrom
feat/jackson3
Aug 29, 2026
Merged

feat!: migrate to Jackson 3#192
marevol merged 1 commit into
masterfrom
feat/jackson3

Conversation

@marevol

@marevol marevol commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Moves jackson-databind to the tools.jackson.core groupId 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:

TokenStreamFactory is immutable. HtmlExtractor and JsonExtractor hardened their mappers by calling mapper.getFactory().setStreamReadConstraints(...) after construction, which Jackson 3 no longer allows. Both now build the factory first and pass it to the mapper:

objectMapper = new ObjectMapper(JsonFactory.builder().streamReadConstraints(constraints).build());

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 by properties(). JsonExtractor.extractObject keeps iterating over an Iterator rather than switching to forEach, so its maxTextLength early exit still applies mid-object.

JsonProcessingException is gone and its replacement JacksonException is unchecked, which left JsonExtractor's catch (IOException) unreachable. It now catches JacksonException and still raises ExtractException("Failed to parse JSON content", e), so a malformed document is reported exactly as before. HtmlExtractor's JSON-LD handler catches JacksonException ahead of its existing catch (RuntimeException).

Verification

  • mvn test: 2097 tests, 0 failures, 0 errors
  • The three touched extractors' own suites pass: JsonExtractorTest (14), HtmlExtractorTest (55), PasswordBasedExtractorTest (18)

Merge order

Requires codelibs/fess-parent (jackson.version -> 3.2.1) to merge first.

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.
@marevol marevol added this to the 15.9.0 milestone Aug 29, 2026
@marevol
marevol merged commit 587806d into master Aug 29, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant