Summary
Jackson 3 flips the FAIL_ON_TRAILING_TOKENS deserialization default from false (Jackson 2) to true. During the migration (#430, PR #431) this leniency was restored on exactly one test mapper (src/test/java/.../expressions/utils/Utils.java:83) but was not restored on the main‑source parse paths, so those became stricter than under Jackson 2. Content after the first parsed value (trailing tokens / trailing typos / concatenated values) that Jackson 2 silently ignored now throws at runtime.
The core public evaluate path is unaffected (it takes a pre‑parsed JsonNode), which is why the test suite stayed green. The exposure is in the file/string loaders below.
Where
Main source (production / public API)
src/main/java/com/api/jsonata4java/JSONataUtils.java:374 — loadJSONFile uses new ObjectMapper().readValue(br, Object.class). This is a public utility used to load .json files. A file that loaded fine under 2.x (trailing whitespace‑separated token, two concatenated values, etc.) now throws a trailing‑token error. Highest impact.
src/main/java/com/api/jsonata4java/Tester.java:123 — the mapper was faithfully rebuilt for ESCAPE_NON_ASCII but does not disable FAIL_ON_TRAILING_TOKENS. Clearest evidence the flag flip was known (fixed in test Utils) but applied inconsistently. CLI tool, lower impact.
src/main/java/com/api/jsonata4java/TesterTimeBox.java:121 — new ObjectMapper() for readTree. CLI tool.
src/main/java/com/api/jsonata4java/testerui/TesterUI.java and Test.java — same pattern; demo/UI, low impact.
Test source (latent inconsistency)
src/test/java/.../expressions/utils/Utils.java:76 (getJson) and :247 (toJson) still use bare new ObjectMapper() while the sibling mapper field (line 83) disables FAIL_ON_TRAILING_TOKENS. Same file, divergent parsing. Currently latent (both helpers are unreferenced), but it undermines the "parse identically to Jackson 2" intent stated in the line‑83 comment.
Verified
FAIL_ON_TRAILING_TOKENS defaults to true in jackson‑databind 3.2.0 (bytecode: iconst_1 in the enum init) vs false in Jackson 2. Only Utils.java:83 compensates.
Suggested fix
Introduce a single shared "Jackson‑2‑compatible" mapper factory (disabling FAIL_ON_TRAILING_TOKENS, and centralizing ESCAPE_NON_ASCII etc.) and route all parse sites through it — at minimum JSONataUtils.loadJSONFile, and the Utils.java getJson/toJson helpers, so parsing behavior no longer diverges by call site. This also addresses the duplicated builder configuration noted during review (identical JsonMapper.builder()... blocks now appear in AgnosticTestSuite and Tester).
Summary
Jackson 3 flips the
FAIL_ON_TRAILING_TOKENSdeserialization default fromfalse(Jackson 2) totrue. During the migration (#430, PR #431) this leniency was restored on exactly one test mapper (src/test/java/.../expressions/utils/Utils.java:83) but was not restored on the main‑source parse paths, so those became stricter than under Jackson 2. Content after the first parsed value (trailing tokens / trailing typos / concatenated values) that Jackson 2 silently ignored now throws at runtime.The core public evaluate path is unaffected (it takes a pre‑parsed
JsonNode), which is why the test suite stayed green. The exposure is in the file/string loaders below.Where
Main source (production / public API)
src/main/java/com/api/jsonata4java/JSONataUtils.java:374—loadJSONFileusesnew ObjectMapper().readValue(br, Object.class). This is a public utility used to load.jsonfiles. A file that loaded fine under 2.x (trailing whitespace‑separated token, two concatenated values, etc.) now throws a trailing‑token error. Highest impact.src/main/java/com/api/jsonata4java/Tester.java:123— the mapper was faithfully rebuilt forESCAPE_NON_ASCIIbut does not disableFAIL_ON_TRAILING_TOKENS. Clearest evidence the flag flip was known (fixed in testUtils) but applied inconsistently. CLI tool, lower impact.src/main/java/com/api/jsonata4java/TesterTimeBox.java:121—new ObjectMapper()forreadTree. CLI tool.src/main/java/com/api/jsonata4java/testerui/TesterUI.javaandTest.java— same pattern; demo/UI, low impact.Test source (latent inconsistency)
src/test/java/.../expressions/utils/Utils.java:76(getJson) and:247(toJson) still use barenew ObjectMapper()while the siblingmapperfield (line 83) disablesFAIL_ON_TRAILING_TOKENS. Same file, divergent parsing. Currently latent (both helpers are unreferenced), but it undermines the "parse identically to Jackson 2" intent stated in the line‑83 comment.Verified
FAIL_ON_TRAILING_TOKENSdefaults totruein jackson‑databind 3.2.0 (bytecode:iconst_1in the enum init) vsfalsein Jackson 2. OnlyUtils.java:83compensates.Suggested fix
Introduce a single shared "Jackson‑2‑compatible" mapper factory (disabling
FAIL_ON_TRAILING_TOKENS, and centralizingESCAPE_NON_ASCIIetc.) and route all parse sites through it — at minimumJSONataUtils.loadJSONFile, and theUtils.javagetJson/toJsonhelpers, so parsing behavior no longer diverges by call site. This also addresses the duplicated builder configuration noted during review (identicalJsonMapper.builder()...blocks now appear inAgnosticTestSuiteandTester).