Fixed isWritable for badly formed SpEL expressions

Before this change isWritable() could return true
for a badly formed expression. That is because the
decision about whether something is writable was made
based on the node type rather than whether the node
represented something that could actually be resolved
to be a real thing. This change ensures a resolution
check is done and isWritable() should only return
true if a subsequent setValue() will succeed.

Issue: SPR-10610
This commit is contained in:
Andy Clement
2014-10-27 11:35:51 -07:00
parent 083dece106
commit 03fc9e89a0
2 changed files with 49 additions and 1 deletions

View File

@@ -384,7 +384,7 @@ public class PropertyOrFieldReference extends SpelNodeImpl {
@Override
public boolean isWritable() {
return true;
return this.ref.isWritableProperty(this.ref.name, this.contextObject, this.evalContext);
}
}