@ -22,6 +22,7 @@ import java.beans.Introspector;
@@ -22,6 +22,7 @@ import java.beans.Introspector;
import java.beans.PropertyDescriptor ;
import java.lang.reflect.Method ;
import java.lang.reflect.Modifier ;
import java.net.URL ;
import java.security.ProtectionDomain ;
import java.util.Collections ;
import java.util.HashSet ;
@ -292,10 +293,12 @@ public final class CachedIntrospectionResults {
@@ -292,10 +293,12 @@ public final class CachedIntrospectionResults {
// Only allow all name variants of Class properties
continue ;
}
if ( pd . getWriteMethod ( ) = = null & & pd . getPropertyType ( ) ! = null & &
( ClassLoader . class . isAssignableFrom ( pd . getPropertyType ( ) ) | |
ProtectionDomain . class . isAssignableFrom ( pd . getPropertyType ( ) ) ) ) {
// Ignore ClassLoader and ProtectionDomain read-only properties - no need to bind to those
if ( URL . class = = beanClass & & "content" . equals ( pd . getName ( ) ) ) {
// Only allow URL attribute introspection, not content resolution
continue ;
}
if ( pd . getWriteMethod ( ) = = null & & isInvalidReadOnlyPropertyType ( pd . getPropertyType ( ) ) ) {
// Ignore read-only properties such as ClassLoader - no need to bind to those
continue ;
}
if ( logger . isTraceEnabled ( ) ) {
@ -344,10 +347,8 @@ public final class CachedIntrospectionResults {
@@ -344,10 +347,8 @@ public final class CachedIntrospectionResults {
// GenericTypeAwarePropertyDescriptor leniently resolves a set* write method
// against a declared read method, so we prefer read method descriptors here.
pd = buildGenericTypeAwarePropertyDescriptor ( beanClass , pd ) ;
if ( pd . getWriteMethod ( ) = = null & & pd . getPropertyType ( ) ! = null & &
( ClassLoader . class . isAssignableFrom ( pd . getPropertyType ( ) ) | |
ProtectionDomain . class . isAssignableFrom ( pd . getPropertyType ( ) ) ) ) {
// Ignore ClassLoader and ProtectionDomain read-only properties - no need to bind to those
if ( pd . getWriteMethod ( ) = = null & & isInvalidReadOnlyPropertyType ( pd . getPropertyType ( ) ) ) {
// Ignore read-only properties such as ClassLoader - no need to bind to those
continue ;
}
this . propertyDescriptors . put ( pd . getName ( ) , pd ) ;
@ -379,8 +380,7 @@ public final class CachedIntrospectionResults {
@@ -379,8 +380,7 @@ public final class CachedIntrospectionResults {
if ( Modifier . isStatic ( method . getModifiers ( ) ) | |
method . getDeclaringClass ( ) = = Object . class | | method . getDeclaringClass ( ) = = Class . class | |
method . getParameterCount ( ) > 0 | | method . getReturnType ( ) = = void . class | |
ClassLoader . class . isAssignableFrom ( method . getReturnType ( ) ) | |
ProtectionDomain . class . isAssignableFrom ( method . getReturnType ( ) ) ) {
isInvalidReadOnlyPropertyType ( method . getReturnType ( ) ) ) {
return false ;
}
try {
@ -393,6 +393,12 @@ public final class CachedIntrospectionResults {
@@ -393,6 +393,12 @@ public final class CachedIntrospectionResults {
}
}
private boolean isInvalidReadOnlyPropertyType ( @Nullable Class < ? > returnType ) {
return ( returnType ! = null & & ( AutoCloseable . class . isAssignableFrom ( returnType ) | |
ClassLoader . class . isAssignableFrom ( returnType ) | |
ProtectionDomain . class . isAssignableFrom ( returnType ) ) ) ;
}
BeanInfo getBeanInfo ( ) {
return this . beanInfo ;