Repository navigation
fix: prevent NullPointerException when property is null in VariableReferenceExpression - #2394
Merged
lbroudoux merged 2 commits intoNov 9, 2026
Conversation
…ariableReferenceExpression Check for null variableValue before evaluating path expressions so that templates safely render null and fallback expressions can proceed. Also guard getProperty against null object and property references. Signed-off-by: Arya Rathore <[email protected]>
…eferenceExpression Verify that null properties with path queries render null and allow fallback expressions to be evaluated, both in isolated expression tests and end-to-end TemplateEngine tests. Signed-off-by: Arya Rathore <[email protected]>
aryarathoree
requested review from
SebastienDegodez,
lbroudoux and
yada
as code owners
October 23, 2026 21:17
lbroudoux
pushed a commit
that referenced
this pull request
Nov 12, 2026
…ferenceExpression (#2394) * fix(util-el): prevent NullPointerException when property is null in VariableReferenceExpression Check for null variableValue before evaluating path expressions so that templates safely render null and fallback expressions can proceed. Also guard getProperty against null object and property references. Signed-off-by: Arya Rathore <[email protected]> * test(util-el): add unit tests for null property handling in VariableReferenceExpression Verify that null properties with path queries render null and allow fallback expressions to be evaluated, both in isolated expression tests and end-to-end TemplateEngine tests. Signed-off-by: Arya Rathore <[email protected]> --------- Signed-off-by: Arya Rathore <[email protected]> (cherry picked from commit 459a69b)
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
When a property reference evaluates to
null(e.g.,request.body/idwhenrequest.bodyisnull),VariableReferenceExpression.getValue()throws aNullPointerExceptionwhen callingvariableValue.getClass().This PR fixes both cases described in #2392:
nulland renders as the string"null".||): A missing property evaluates tonull, allowingFallbackExpressionto use the provided default (e.g.,'default').Additionally:
getProperty(obj, property)to prevent a secondaryNullPointerExceptionwhen logging warnings for a null object.TemplateEngineTest, along with unit tests inVariableReferenceExpressionTestandFallbackExpressionTest.Related issue(s)
Fixes #2392
Testing
Ran the
microcks-eltest suite: