CAMEL-24585: Fix catalog validateLanguageExpression NPE for simple expressions using jsonpath/jq/xpath functions - #26036
Merged
Merged
Conversation
Contributor
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
Croway
approved these changes
Sep 2, 2026
Contributor
|
🧪 CI tested the following changed modules:
🔬 Scalpel shadow comparison — Scalpel: 563 tested, 26 compile-only — current: 562 all testedMaveniverse Scalpel detected 589 affected modules (current approach: 562).
|
…pressions using jsonpath/jq/xpath functions
LanguageSupport.property() unconditionally called CamelContext.getTypeConverter()
to convert (even already-typed) default option values. When validating a simple
expression that delegates to another language (e.g. ${jsonpath(...)}), the tooling
uses a bare, uninitialized CamelContext whose getTypeConverter() returns null,
resulting in an NPE. Guard against a null type converter and return the value
as-is in that case.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
davsclaus
force-pushed
the
fix/CAMEL-24585
branch
from
September 2, 2026 14:57
ba1def6 to
d286ef9
Compare
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.
Description
CAMEL-24585
CamelCatalog.validateLanguageExpression(cl, "simple", "${jsonpath($.foo)}")fails with:This regressed for simple expressions that embed a delegating language function
(
${jsonpath(...)},${jq(...)},${xpath(...)}). Plain simple expressions(
${header.foo},${bodyAs(String)}) are unaffected.Root cause
The catalog validates simple expressions by parsing them against a deliberately
uninitialized
SimpleCamelContext(no type converter). When the simple parserencounters a delegating function it eagerly initializes the target language
(via
ExpressionBuilder.languageExpression), which resolves the target language'sdefault option values through
LanguageSupport.property(). That methodunconditionally called
camelContext.getTypeConverter().convertTo(type, value)— even for values that are already the correct type (e.g. the
suppressExceptionsboolean default) — and
getTypeConverter()isnullon the bare tooling context,producing an NPE.
Fix
Guard
LanguageSupport.property()against a null type converter: when no converteris available (i.e. a bare
CamelContextused only for tooling/validation), returnthe value as-is, mirroring the existing
camelContext == nullbranch. In a fullyinitialized runtime context the type converter is always present, so runtime
behavior is unchanged.
Testing
CamelCatalogTest#testValidateSimpleJSonPathFunctionvalidating
${jsonpath($.foo)}(expression and predicate) succeeds.mvn clean install -Dquickly) passes.Claude Code on behalf of davsclaus