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: comparison/equality operators throw on mismatched or out-of-range operands (e.g. 3.14 = "abc") #432
After the Jackson 3 migration (#430, PR #431), the comparison (<, >, <=, >=) and equality (=, in) operators can throw a raw, uncaught tools.jackson.databind.node.JsonNodeException instead of returning a value. In Jackson 2 the underlying asDouble()/asLong() calls coerced non‑numeric strings to 0.0 and silently narrowed out‑of‑range integers; Jackson 3 made these coercions fail‑fast (they throw). The affected call sites are unguarded and their lines were not changed by the migration, so the behavior flipped from "return a boolean" to "crash".
This was not caught by the test suite — no existing test exercises these mismatched/out‑of‑range operand combinations.
In every case the branch is entered as soon as one side is floating‑point (or both are integral), with no check that the other side is actually numeric / in range.
The 3.14 = "abc" case is the most serious: comparing a number to a non‑numeric string for equality is legal JSONata and must yield false, not raise an exception.
Verified empirically against jackson‑databind 3.2.0
Guard each numeric branch so the throwing coercion is only reached for actually‑coercible operands (e.g. require both sides numeric before asDouble()/asLong(), or range‑check with canConvertToLong() and fall back to doubleValue()/bigIntegerValue()), mirroring the guards already added to MatchFunction/ReplaceFunction/ArrayUtils.compare in this migration. Where operand types are genuinely incompatible, throw the controlled EvaluateRuntimeException the code already uses for the string/type‑mismatch branches rather than leaking a Jackson exception.
Activity