[SPR-6063] fixed issue with inconsistent views of PropertyDescriptors

This commit is contained in:
Rob Harrop
2009-09-16 09:53:14 +00:00
parent aa08c11976
commit 01fb1825f5
4 changed files with 55 additions and 2 deletions

View File

@@ -338,7 +338,7 @@ public abstract class BeanUtils {
*/
public static PropertyDescriptor[] getPropertyDescriptors(Class<?> clazz) throws BeansException {
CachedIntrospectionResults cr = CachedIntrospectionResults.forClass(clazz);
return cr.getBeanInfo().getPropertyDescriptors();
return cr.getPropertyDescriptors();
}
/**

View File

@@ -275,7 +275,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
public PropertyDescriptor[] getPropertyDescriptors() {
return getCachedIntrospectionResults().getBeanInfo().getPropertyDescriptors();
return getCachedIntrospectionResults().getPropertyDescriptors();
}
public PropertyDescriptor getPropertyDescriptor(String propertyName) throws BeansException {

View File

@@ -29,6 +29,7 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap;
import java.util.Collection;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -268,4 +269,9 @@ public class CachedIntrospectionResults {
return this.propertyDescriptorCache.get(propertyName);
}
PropertyDescriptor[] getPropertyDescriptors() {
Collection<PropertyDescriptor> descriptorCollection = this.propertyDescriptorCache.values();
return descriptorCollection.toArray(new PropertyDescriptor[descriptorCollection.size()]);
}
}