Ignore non-prop 'set' methods in ExtendedBeanInfo

Previously, ExtendedBeanInfo would attempt to process methods named
exactly 'set'.  JavaBeans properties must have at least one character
following the 'set' prefix in order to qualify, and this is now
respected by EBI.

Thanks to Rob Winch for the patch fixing this problem.

Issue: SPR-8175
This commit is contained in:
Chris Beams
2011-04-05 03:45:38 +00:00
parent eba33b6156
commit 158a392d80
2 changed files with 23 additions and 4 deletions

View File

@@ -82,6 +82,9 @@ public class ExtendedBeanInfo implements BeanInfo {
// is the method a NON-INDEXED setter? ignore return type in order to capture non-void signatures
if (method.getName().startsWith("set") && method.getParameterTypes().length == 1) {
String propertyName = propertyNameFor(method);
if(propertyName.length() == 0) {
continue ALL_METHODS;
}
for (PropertyDescriptor pd : delegate.getPropertyDescriptors()) {
Method readMethod = pd.getReadMethod();
Method writeMethod = pd.getWriteMethod();
@@ -109,6 +112,9 @@ public class ExtendedBeanInfo implements BeanInfo {
// is the method an INDEXED setter? ignore return type in order to capture non-void signatures
if (method.getName().startsWith("set") && method.getParameterTypes().length == 2 && method.getParameterTypes()[0].equals(int.class)) {
String propertyName = propertyNameFor(method);
if(propertyName.length() == 0) {
continue ALL_METHODS;
}
DELEGATE_PD:
for (PropertyDescriptor pd : delegate.getPropertyDescriptors()) {
if (!(pd instanceof IndexedPropertyDescriptor)) {