Overview
AbstractNestablePropertyAccessor currently resolves nested property paths such as a.b.c.d recursively, one recursive call per path segment and with no limit on depth. Against a type with deeply nested structures, a sufficiently long path can exhaust the stack with a StackOverflowError and no useful diagnostics.
Thanks to @Banh-Bao-080899 for raising this and suggesting a nesting-depth limit, similar to what we did for SpEL in #36723. The goal is to track nesting depth while resolving a property path and then fail fast with a descriptive exception if a configurable limit is exceeded, rather than recursing until the stack overflows.
NOTE: This issue is assigned and therefore not suitable for community contributions.
Implementation Ideas
- Add a nesting-depth counter in
AbstractNestablePropertyAccessor.
- Throw a descriptive exception (e.g.,
InvalidPropertyException) if the limit is exceeded.
- Expose the limit as a configurable property, analogous to
autoGrowCollectionLimit on ConfigurablePropertyAccessor, with a sensible default.
- Apply regardless of
autoGrowNestedPaths, since resolving an existing deep object graph recurses the same way as auto-growing one.
Overview
AbstractNestablePropertyAccessorcurrently resolves nested property paths such asa.b.c.drecursively, one recursive call per path segment and with no limit on depth. Against a type with deeply nested structures, a sufficiently long path can exhaust the stack with aStackOverflowErrorand no useful diagnostics.Thanks to @Banh-Bao-080899 for raising this and suggesting a nesting-depth limit, similar to what we did for SpEL in #36723. The goal is to track nesting depth while resolving a property path and then fail fast with a descriptive exception if a configurable limit is exceeded, rather than recursing until the stack overflows.
NOTE: This issue is assigned and therefore not suitable for community contributions.
Implementation Ideas
AbstractNestablePropertyAccessor.InvalidPropertyException) if the limit is exceeded.autoGrowCollectionLimitonConfigurablePropertyAccessor, with a sensible default.autoGrowNestedPaths, since resolving an existing deep object graph recurses the same way as auto-growing one.