Browse Source

PropertyOrFieldReference defensively catches Exception instead of just AccessException

Issue: SPR-13247
pull/840/merge
Juergen Hoeller 11 years ago
parent
commit
34a81b605a
  1. 15
      spring-expression/src/main/java/org/springframework/expression/spel/ast/PropertyOrFieldReference.java

15
spring-expression/src/main/java/org/springframework/expression/spel/ast/PropertyOrFieldReference.java

@ -187,9 +187,9 @@ public class PropertyOrFieldReference extends SpelNodeImpl {
try { try {
return accessorToUse.read(evalContext, contextObject.getValue(), name); return accessorToUse.read(evalContext, contextObject.getValue(), name);
} }
catch (AccessException ex) { catch (Exception ex) {
// this is OK - it may have gone stale due to a class change, // This is OK - it may have gone stale due to a class change,
// let's try to get a new one and call it before giving up // let's try to get a new one and call it before giving up...
this.cachedReadAccessor = null; this.cachedReadAccessor = null;
} }
} }
@ -212,7 +212,7 @@ public class PropertyOrFieldReference extends SpelNodeImpl {
} }
} }
} }
catch (AccessException ex) { catch (Exception ex) {
throw new SpelEvaluationException(ex, SpelMessage.EXCEPTION_DURING_PROPERTY_READ, name, ex.getMessage()); throw new SpelEvaluationException(ex, SpelMessage.EXCEPTION_DURING_PROPERTY_READ, name, ex.getMessage());
} }
} }
@ -238,9 +238,9 @@ public class PropertyOrFieldReference extends SpelNodeImpl {
accessorToUse.write(evalContext, contextObject.getValue(), name, newValue); accessorToUse.write(evalContext, contextObject.getValue(), name, newValue);
return; return;
} }
catch (AccessException ex) { catch (Exception ex) {
// this is OK - it may have gone stale due to a class change, // This is OK - it may have gone stale due to a class change,
// let's try to get a new one and call it before giving up // let's try to get a new one and call it before giving up...
this.cachedWriteAccessor = null; this.cachedWriteAccessor = null;
} }
} }
@ -291,7 +291,6 @@ public class PropertyOrFieldReference extends SpelNodeImpl {
return false; return false;
} }
// TODO when there is more time, remove this and use the version in AstUtils
/** /**
* Determines the set of property resolvers that should be used to try and access a property * Determines the set of property resolvers that should be used to try and access a property
* on the specified target type. The resolvers are considered to be in an ordered list, * on the specified target type. The resolvers are considered to be in an ordered list,

Loading…
Cancel
Save