Title: Jackson 3: numeric functions/operators throw on out-of-range values ($fromMillis, $sum, unary minus, range, array index) · Issue #433 · IBM/JSONata4Java · GitHub
Open Graph Title: Jackson 3: numeric functions/operators throw on out-of-range values ($fromMillis, $sum, unary minus, range, array index) · Issue #433 · IBM/JSONata4Java
X Title: Jackson 3: numeric functions/operators throw on out-of-range values ($fromMillis, $sum, unary minus, range, array index) · Issue #433 · IBM/JSONata4Java
Description: Summary After the Jackson 3 migration (#430, PR #431), several numeric functions and operators call asInt()/asLong() on values that are outside int/long range. Jackson 3 makes these coercions fail‑fast — they throw tools.jackson.databind...
Open Graph Description: Summary After the Jackson 3 migration (#430, PR #431), several numeric functions and operators call asInt()/asLong() on values that are outside int/long range. Jackson 3 makes these coercions fail‑...
X Description: Summary After the Jackson 3 migration (#430, PR #431), several numeric functions and operators call asInt()/asLong() on values that are outside int/long range. Jackson 3 makes these coercions fail‑...
Opengraph URL: https://github.com/IBM/JSONata4Java/issues/433
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Jackson 3: numeric functions/operators throw on out-of-range values ($fromMillis, $sum, unary minus, range, array index)","articleBody":"## Summary\n\nAfter the Jackson 3 migration (#430, PR #431), several numeric functions and operators call `asInt()`/`asLong()` on values that are outside `int`/`long` range. Jackson 3 makes these coercions **fail‑fast** — they throw `tools.jackson.databind.node.JsonNodeException` for out‑of‑range `DoubleNode`/`BigIntegerNode` values. Jackson 2 silently narrowed (a plain cast), so these paths previously produced a (possibly wrong but non‑throwing) value or a controlled JSONata error. The lines were not changed by the migration, so behavior flipped from \"return/handle\" to \"crash\".\n\nNot caught by the test suite — no test exercises out‑of‑range magnitudes at these sites.\n\n## Where \u0026 reproductions\n\n| Site | Code | Repro | Jackson 2 | Jackson 3 |\n| --- | --- | --- | --- | --- |\n| `ExpressionsVisitor.java:381` `isWholeNumber` | `n.asInt() == n.asDouble()` | `[1..1e19]` (range bound) | returns `false` → controlled \"must be an integer\" error | **throws** raw `JsonNodeException` |\n| `ExpressionsVisitor.java:994` (array index) | `indexInContext.asInt()` | `[\"a\",\"b\"][3000000000]` | narrows → harmless out‑of‑bounds | **throws** |\n| `ExpressionsVisitor.java:2919/2925` (unary minus) | `operand.asLong()` on `BigIntegerNode` | `-99999999999999999999999999` | narrowed long | **throws** |\n| `FromMillisFunction.java:90` | `argNumber.asLong()` (guarded only by `isNumber()`) | `$fromMillis(1e30)` | narrowed → wrong date | **throws** |\n| `FromMillisZonedFunction.java:90` | `argNumber.asLong()` | `$fromMillisTz(1e30, '[Y]')` | narrowed | **throws** |\n| `SumFunction.java:95` and `:107` | `a.asLong()` / `argArray.asLong()` on out‑of‑range `BigIntegerNode` | `$sum([99999999999999999999999999])` | narrowed | **throws** |\n\n## Verified empirically against jackson‑databind 3.2.0\n\n```\nDoubleNode(1.0E46).asInt() -\u003e THROWS JsonNodeException\nDoubleNode(1.0E46).asLong() -\u003e THROWS JsonNodeException\nBigIntegerNode(99999999999999999999).asLong() -\u003e THROWS JsonNodeException\nLongNode(3000000000).asInt() -\u003e THROWS JsonNodeException\n```\n\n## Suggested fix\n\nBefore calling `asInt()`/`asLong()` at these sites, pre‑check magnitude (`canConvertToInt()` / `canConvertToLong()`) or operate on `doubleValue()`/`bigIntegerValue()` and range‑check, restoring the Jackson‑2 narrowing (or converting to the appropriate controlled JSONata error) rather than allowing a raw `JsonNodeException` to escape. This mirrors the guard already applied to `AgnosticTestSuite`'s `(long) d` fix in this migration.\n","author":{"url":"https://github.com/wnm3","@type":"Person","name":"wnm3"},"datePublished":"2026-07-07T16:39:05.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/433/JSONata4Java/issues/433"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0e3c625f-c174-71a6-4ff6-ace784633899 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BBEC:228D4:1E02E7:2B514D:6A4E673F |
| html-safe-nonce | f55724da987cc3e0fed0420b59413bdd16816340f298132d49262920347830a3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQkVDOjIyOEQ0OjFFMDJFNzoyQjUxNEQ6NkE0RTY3M0YiLCJ2aXNpdG9yX2lkIjoiNjY3MzM3MTk3MTI4MTkwNTQ3MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3f5a1ca40d38dbf2a0388ecfc4157fbc89abc428ee03503f5c28de92b70f082f |
| hovercard-subject-tag | issue:4830451134 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/IBM/JSONata4Java/433/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0cca55a5745b42df512f82152a739fe4f1e334bc460d41c48bd97e5c18699e1a/IBM/JSONata4Java/issues/433 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0cca55a5745b42df512f82152a739fe4f1e334bc460d41c48bd97e5c18699e1a/IBM/JSONata4Java/issues/433 |
| og:image:alt | Summary After the Jackson 3 migration (#430, PR #431), several numeric functions and operators call asInt()/asLong() on values that are outside int/long range. Jackson 3 makes these coercions fail‑... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | wnm3 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 41b6ab3ba6d20a71766ac245b5a4a94c6fc672a9cd4da7d44c1b33ab8bf6a21c |
| turbo-cache-control | no-preview |
| go-import | github.com/IBM/JSONata4Java git https://github.com/IBM/JSONata4Java.git |
| octolytics-dimension-user_id | 1459110 |
| octolytics-dimension-user_login | IBM |
| octolytics-dimension-repository_id | 169904880 |
| octolytics-dimension-repository_nwo | IBM/JSONata4Java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 169904880 |
| octolytics-dimension-repository_network_root_nwo | IBM/JSONata4Java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e6a744804e8e70f97b4d5a18a94dcc63db22f97a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width