Fix potential ScopeSearchingPropertyAccessor NPE

ScopeSearchingPropertyAccessor.read() now returns a TypedValue
representing null rather than null itself.  This prevents a
NullPointerException from being thrown from deeper within the Spring
SpEL code

Issue: SWF-1572
This commit is contained in:
Phillip Webb
2012-11-13 12:57:21 -08:00
parent c85b63cce6
commit 55a69b568f

View File

@@ -40,7 +40,7 @@ public class ScopeSearchingPropertyAccessor implements PropertyAccessor {
public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException {
MutableAttributeMap<Object> scope = findScopeForAttribute((RequestContext) target, name);
return (scope != null) ? new TypedValue(scope.get(name)) : null;
return new TypedValue(scope == null ? null : scope.get(name));
}
public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException {