[backport camel-4.18.x] CAMEL-24187: CamelContext.getEndpoint() never caches a uri containing a % character#24808
Merged
Conversation
…point() never caches a uri containing a % character Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
gnodet
approved these changes
Jul 16, 2026
gnodet
left a comment
Contributor
There was a problem hiding this comment.
LGTM — clean backport of #24805 to camel-4.18.x.
The AbstractCamelContext fix and DefaultEndpointRegistryTest are identical to the main
branch version. The plc4x reproducer test is correctly excluded (component may not be on 4.18.x).
Already reviewed the original PR in detail — the normalized flag correctly prevents
double-normalization of URIs containing %, which made NormalizedUri keys non-idempotent
(%41 → %2541 on second pass).
Claude Code on behalf of gnodet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Backport of #24805 to
camel-4.18.x(excludes the camel-plc4x test).AbstractCamelContext.doGetEndpoint()normalizes the URI once for cache lookup, but on a cache miss passes the already-normalized URI toaddEndpointToRegistry(), which normalizes it a second time. SinceEndpointHelper.normalizeEndpointUri()is not idempotent for URIs containing%(each pass encodes%41→%2541), the stored registry key never matches a later lookup key — causinggetEndpoint()to create a brand-newEndpointon every call instead of reusing the cached singleton.normalized-aware overload ofgetEndpointKey()/addEndpointToRegistry()so thedoGetEndpoint()call site skips redundant re-normalization. Public APIs (hasEndpoint,addEndpoint,removeEndpoints) are unchanged.%and is re-resolved by string (pollEnrich/toD/recipientList).Test plan
DefaultEndpointRegistryTest#testGetEndpointIsCachedForUriContainingPercentCharacterverifies the fix usingcontrolbus:route?routeId=RAW(%41)&action=status.Claude Opus 4.6 on behalf of Croway