You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fesod.apache.org by "BigDataDZ (via GitHub)" <gi...@apache.org> on 2026/10/07 14:29:48 UTC
[PR] fix: reject out-of-range integer cell values instead of wrapping them (#1100) [fesod]
BigDataDZ opened a new pull request, #1188:
URL: https://github.com/apache/fesod/pull/1188
## What changed
- New `NumberUtils#narrowInRange(BigDecimal, long, long)`: truncates toward zero (preserving the previous fractional behavior) and then range-checks the truncated value with `BigDecimal#compareTo`, throwing `ArithmeticException` on overflow.
- `ByteNumberConverter`, `ShortNumberConverter`, `IntegerNumberConverter` and `LongNumberConverter` narrow through it instead of calling `byteValue()` / `shortValue()` / `intValue()` / `longValue()` directly.
- `NumberUtils#parseByte` / `#parseShort` / `#parseInteger` / `#parseLong` (the string-cell path) apply the same range check, on both the plain and the DecimalFormat-backed branches.
## Why
An out-of-range cell silently wrapped instead of failing:
```java
// cell 13800138000 into an Integer field printed 915236112 (13800138000 mod 2^32)
// Short 40000 -> -25536, Byte "300" -> 44, Long.MAX_VALUE -> -9223372036854771616
```
No exception was raised, so corrupted reads went unnoticed. Fractional values keep truncating as before (`123.9` still reads as `123`); only values whose truncated integer part falls outside the target range now throw.
Fixes #1100
## How tested
- New converter tests for all four types: in-range, boundary (MIN/MAX), fractional truncation, out-of-range throws.
- New `NumberUtilsTest` cases: parse* rejects out-of-range strings, accepts boundary values, and keeps truncating fractions.
- Full `fesod-sheet` suite (938 tests) passes locally on Temurin 25; `spotless:check` clean.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fesod.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fesod.apache.org
For additional commands, e-mail: commits-help@fesod.apache.org
Re: [PR] fix: reject out-of-range integer cell values instead of wrapping them (#1100) [fesod]
Posted by "nkuprins (via GitHub)" <gi...@apache.org>.
nkuprins commented on PR #1188:
URL: https://github.com/apache/fesod/pull/1188#issuecomment-6040236248
Hi @BigDataDZ,
Thank you for your interest. There is already a corresponding fix PR (https://github.com/apache/fesod/pull/1101) for this issue. If you'd like, you're also welcome to review it or add further comments to the discussion here.
Therefore, this PR may be closed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fesod.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fesod.apache.org
For additional commands, e-mail: commits-help@fesod.apache.org
Re: [PR] fix: reject out-of-range integer cell values instead of wrapping them (#1100) [fesod]
Posted by "BigDataDZ (via GitHub)" <gi...@apache.org>.
BigDataDZ closed pull request #1188: fix: reject out-of-range integer cell values instead of wrapping them (#1100)
URL: https://github.com/apache/fesod/pull/1188
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fesod.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fesod.apache.org
For additional commands, e-mail: commits-help@fesod.apache.org
Re: [PR] fix: reject out-of-range integer cell values instead of wrapping them (#1100) [fesod]
Posted by "BigDataDZ (via GitHub)" <gi...@apache.org>.
BigDataDZ commented on PR #1188:
URL: https://github.com/apache/fesod/pull/1188#issuecomment-6040541005
Thanks @nkuprins for the pointer - sorry I missed #1101 when scanning the tracker. Your approach (truncate toward zero, then range-check) matches what I had implemented, so there is no reason to keep two PRs for the same fix. Closing this one in favor of #1101.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fesod.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fesod.apache.org
For additional commands, e-mail: commits-help@fesod.apache.org