Skip to content

[backport camel-4.18.x] CAMEL-24407: simple predicate fails for long digital strings - #25979

Merged
davsclaus merged 1 commit into
camel-4.18.xfrom
backport/CAMEL-24407-4.18.x
Aug 31, 2026
Merged

[backport camel-4.18.x] CAMEL-24407: simple predicate fails for long digital strings#25979
davsclaus merged 1 commit into
camel-4.18.xfrom
backport/CAMEL-24407-4.18.x

Conversation

@davsclaus

Copy link
Copy Markdown
Contributor

Backport of #25945

Cherry-pick of #25945 onto camel-4.18.x.

Original PR: #25945 - CAMEL-24407: simple predicate fails for long digital strings
Original author: @k-krawczyk
Target branch: camel-4.18.x

Original description

The simple language throws NumberFormatException when it compares numbers with more digits
than a long can hold, such as bank account numbers. ObjectHelper.isNumber only checks that the
text is all digits, and the callers then parse it with Long.parseLong or Integer.valueOf.

String to String comparisons fall back to BigInteger when the value does not fit in a long.
A number outside the long range can never equal an int or a long, so equality against one is
false, and ordering against one is decided as BigInteger. A numeric literal in a predicate
that does not fit in a long is now kept as literal text, so it takes the same comparison path
as a header would.

See #25945 for full details, reproduction and test coverage.

This is a straight cherry-pick with no manual conflict resolution; the change was already
reviewed and merged on main.

Claude Code on behalf of davsclaus

Numbers with more digits than a long can hold, such as bank account
numbers, made comparisons throw NumberFormatException. isNumber only
checks that the text is all digits, and the callers then parsed it
with Long.parseLong or Integer.valueOf.

Compare those as BigInteger instead. A number that does not fit in a
long can never equal an int or long, so equality with one is false.
A numeric literal in a simple predicate that does not fit in a long is
now kept as literal text, so it takes the same comparison path.

Co-authored-by: Claude <noreply@anthropic.com>
@davsclaus davsclaus added the backport indicate that a Pull request is a backport from a fix from the main branch label Aug 31, 2026

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving this backport of #25945 to camel-4.18.x.

The original PR (CAMEL-24407: simple predicate fails for long digital strings) was reviewed and approved — this backport carries the same changes across all 7 files. Straight cherry-pick with identical file list.

This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.

Claude Code on behalf of Guillaume Nodet

@davsclaus davsclaus added the bug Something isn't working label Aug 31, 2026
@davsclaus davsclaus added this to the 4.18.5 milestone Aug 31, 2026
@davsclaus davsclaus self-assigned this Aug 31, 2026
@davsclaus
davsclaus merged commit a800893 into camel-4.18.x Aug 31, 2026
3 checks passed
@davsclaus
davsclaus deleted the backport/CAMEL-24407-4.18.x branch August 31, 2026 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport indicate that a Pull request is a backport from a fix from the main branch bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants