'if (propValue == null)' ,' isAutoGrowNestedPaths()' always returns false. So remove the never accessable code, direct throw exception.
Comment From: yilianhuaixiao
@mdeinum I am not sure about your words. The propValue
represents the direct souce of the tokens
paremeter.
For example, if the tokens.canonicalName
is listOfMaps[0]['luckyNumber']
. the propValue
represents listOfMaps[0]
object.
And in getPropertyValue
method in AbstractNestablePropertyAccessor
:
if (isAutoGrowNestedPaths()) {
value = setDefaultValue(new PropertyTokenHolder(tokens.actualName));
}
in
private Object setDefaultValue(PropertyTokenHolder tokens) {
PropertyValue pv = createDefaultPropertyValue(tokens);
setPropertyValue(tokens, pv);
Object defaultValue = getPropertyValue(tokens);
Assert.state(defaultValue != null, "Default value must not be null");
return defaultValue;
}
Default value must not be null.
So once the propValue == null
,
it means isAutoGrowNestedPaths
always be false
.
Comment From: snicoll
Yes I agree with @mdeinum here. Thanks for the PR, in any case.