Avoid NPE when registering a SpEL MethodFilter

Attempting to register a custom MethodFilter with a
StandardEvaluationContext after invoking setMethodResolvers() with a
custom list of MethodResolver instances results in a
NullPointerException. Based on the current documentation in
StandardEvaluationContext it is unclear what the expected behavior
should be, but either the implementation is broken, or the use case is
unsupported. In either case, allowing a NullPointerException to be
thrown is inappropriate.

This commit documents the fact that the SpEL MethodFilter is intended to
be used with the ReflectiveMethodResolver. Furthermore,
StandardEvaluationContext.registerMethodFilter() now throws an
IllegalStateException if the user attempts to set a filter after having
registered a custom set of resolvers.

Issue: SPR-9621
This commit is contained in:
Andy Clement
2012-08-07 10:12:10 -07:00
committed by Sam Brannen
parent 51bac37d9b
commit f5d3cd07e7
3 changed files with 70 additions and 10 deletions

View File

@@ -9,9 +9,10 @@ Changes in version 3.2 M2 (2012-08-xx)
* spring-test module now depends on junit:junit-dep (SPR-6966)
* now inferring return type of generic factory methods (SPR-9493)
* SpEL now supports method invocations on integers (SPR-9612)
* SpEL now supports case-insensitive null literals in expressions (SPR-9613)
* SpEL now supports symbolic boolean operators for OR and AND (SPR-9614)
* SpEL now supports nested double quotes in expressions (SPR-9620)
* introduced support for case-insensitive null literals in SpEL expressions (SPR-9613)
* SpEL now throws an ISE if a MethodFilter is registered against custom resolvers (SPR-9621)
* now using BufferedInputStream in SimpleMetaDataReader to double performance (SPR-9528)
* introduced "repeatCount" property in Quartz SimpleTriggerFactoryBean (SPR-9521)
* introduced "jtaTransactionManager" property in Hibernate 4 LocalSessionFactoryBean/Builder (SPR-9480)