Avoid NPE on BeanDescriptor access with SimpleBeanInfoFactory

Closes gh-29681

(cherry picked from commit d74191427e)
This commit is contained in:
Juergen Hoeller
2022-12-13 11:07:22 +01:00
parent 912fa7602a
commit 8c80ec1138
2 changed files with 20 additions and 0 deletions

View File

@@ -16,6 +16,7 @@
package org.springframework.beans;
import java.beans.BeanDescriptor;
import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.PropertyDescriptor;
@@ -51,6 +52,10 @@ public class SimpleBeanInfoFactory implements BeanInfoFactory, Ordered {
PropertyDescriptorUtils.determineBasicProperties(beanClass);
return new SimpleBeanInfo() {
@Override
public BeanDescriptor getBeanDescriptor() {
return new BeanDescriptor(beanClass);
}
@Override
public PropertyDescriptor[] getPropertyDescriptors() {
return pds.toArray(PropertyDescriptorUtils.EMPTY_PROPERTY_DESCRIPTOR_ARRAY);