Summary
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
} else if (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: throws
JsonNodeException.
2. BooleanUtils.java:89 — asBoolean() on a BinaryNode
case BINARY:
return node.asBoolean();
- Jackson 2: returns the default
false for a BinaryNode.
- Jackson 3: throws
JsonNodeException.
- 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
IntNode(5).textValue() -> THROWS JsonNodeException
BinaryNode.asBoolean() -> THROWS JsonNodeException
Related minor note (low priority)
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().
Summary
Two unguarded coercion call sites changed behavior under the Jackson 3 migration (#430, PR #431). Jackson 3 tightened
textValue()(nowstringValue(), throws for any non‑String node) and the no‑argasBoolean()(throws for non‑coercible node types). Jackson 2 returnednull/falserespectively. These lines were not changed by the migration, so behavior flipped from "return default" to "throwtools.jackson.databind.node.JsonNodeException".Not caught by the test suite.
Where & reproductions
1.
JoinFunction.java:121—textValue()on non‑string inner elementNote the outer element at line 117 is guarded (
element.isTextual()), but the inner loop at 121 is not.$join([[1, 2]])textValue()returnsnull→StringJoinerappends"null"→ result"nullnull".JsonNodeException.2.
BooleanUtils.java:89—asBoolean()on aBinaryNodefalsefor aBinaryNode.JsonNodeException.BinaryNodereaching$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
Related minor note (low priority)
ArrayUtils.compare(line 105, changed in this PR) now usesasText(""). For a container node this correctly restores the Jackson‑2"", but for aPOJONodeit returns""where Jackson 2 returned the POJO'stoString(). Reachability is very low ($sort over a regexPOJONodeis not a realistic user path), so this is noted rather than treated as a separate defect.Suggested fix
Add an
isTextual()guard atJoinFunction:121(matching line 117) — decide whether a non‑string inner element should stringify via the JSONata number/string rules or raise the existingERR_MSG_ARG1_ARR_STR. ForBooleanUtils:89, returnfalseexplicitly for theBINARYcase rather than delegating to the now‑throwingasBoolean().