PropertyOrFieldReference defensively catches Exception instead of just AccessException

Issue: SPR-13247
This commit is contained in:
Juergen Hoeller 2015-07-20 13:04:34 +02:00
parent cad0665187
commit 34a81b605a
1 changed files with 7 additions and 8 deletions

View File

@ -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,