You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Jackson 3: unguarded textValue()/asBoolean() throw where Jackson 2 returned defaults (JoinFunction, BooleanUtils) #434
Two unguarded coercion call sites changed behavior under the Jackson 3 migration (#430, PR #431). Jackson 3 tightened textValue() (now stringValue(), throws for any non‑String node) and the no‑arg asBoolean() (throws for non‑coercible node types). Jackson 2 returned null / false respectively. These lines were not changed by the migration, so behavior flipped from "return default" to "throw tools.jackson.databind.node.JsonNodeException".
Not caught by the test suite.
Where & reproductions
1. JoinFunction.java:121 — textValue() on non‑string inner element
} elseif (element.isArray()) {
for (Iterator<JsonNode> it = ((ArrayNode) element).iterator(); it.hasNext();) {
stringJoiner.add(it.next().textValue()); // <-- no isTextual() guard
}
}
Note the outer element at line 117 is guarded (element.isTextual()), but the inner loop at 121 is not.
Repro: $join([[1, 2]])
Jackson 2: textValue() returns null → StringJoiner appends "null" → result "nullnull".
Jackson 3: throwsJsonNodeException.
2. BooleanUtils.java:89 — asBoolean() on a BinaryNode
caseBINARY:
returnnode.asBoolean();
Jackson 2: returns the default false for a BinaryNode.
Jackson 3: throwsJsonNodeException.
Lower reachability (requires a BinaryNode reaching $boolean(...)), but it is an unguarded no‑arg coercion of exactly the kind this migration must audit.
Verified empirically against jackson‑databind 3.2.0
ArrayUtils.compare (line 105, changed in this PR) now uses asText(""). For a container node this correctly restores the Jackson‑2 "", but for a POJONode it returns "" where Jackson 2 returned the POJO's toString(). Reachability is very low ($sort over a regex POJONode is not a realistic user path), so this is noted rather than treated as a separate defect.
Suggested fix
Add an isTextual() guard at JoinFunction:121 (matching line 117) — decide whether a non‑string inner element should stringify via the JSONata number/string rules or raise the existing ERR_MSG_ARG1_ARR_STR. For BooleanUtils:89, return false explicitly for the BINARY case rather than delegating to the now‑throwing asBoolean().
Activity
Fix out-of-range numeric coercion and related Jackson 3 fail-fast cra…
Fix out-of-range numeric coercion and related Jackson 3 fail-fast cra…
Migrate from Jackson 2.x to Jackson 3 (tools.jackson) (#430) (#431)