|
1 | 1 | /* |
2 | | - * Copyright 2002-2020 the original author or authors. |
| 2 | + * Copyright 2002-2022 the original author or authors. |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
|
20 | 20 | import java.beans.IntrospectionException; |
21 | 21 | import java.beans.Introspector; |
22 | 22 | import java.beans.PropertyDescriptor; |
| 23 | +import java.security.ProtectionDomain; |
23 | 24 | import java.util.Collections; |
24 | 25 | import java.util.LinkedHashMap; |
25 | 26 | import java.util.List; |
@@ -281,9 +282,13 @@ private CachedIntrospectionResults(Class<?> beanClass) throws BeansException { |
281 | 282 | // This call is slow so we do it once. |
282 | 283 | PropertyDescriptor[] pds = this.beanInfo.getPropertyDescriptors(); |
283 | 284 | for (PropertyDescriptor pd : pds) { |
284 | | - if (Class.class == beanClass && |
285 | | - ("classLoader".equals(pd.getName()) || "protectionDomain".equals(pd.getName()))) { |
286 | | - // Ignore Class.getClassLoader() and getProtectionDomain() methods - nobody needs to bind to those |
| 285 | + if (Class.class == beanClass && (!"name".equals(pd.getName()) && !pd.getName().endsWith("Name"))) { |
| 286 | + // Only allow all name variants of Class properties |
| 287 | + continue; |
| 288 | + } |
| 289 | + if (pd.getPropertyType() != null && (ClassLoader.class.isAssignableFrom(pd.getPropertyType()) |
| 290 | + || ProtectionDomain.class.isAssignableFrom(pd.getPropertyType()))) { |
| 291 | + // Ignore ClassLoader and ProtectionDomain types - nobody needs to bind to those |
287 | 292 | continue; |
288 | 293 | } |
289 | 294 | if (logger.isTraceEnabled()) { |
@@ -321,6 +326,11 @@ private void introspectInterfaces(Class<?> beanClass, Class<?> currClass) throws |
321 | 326 | // GenericTypeAwarePropertyDescriptor leniently resolves a set* write method |
322 | 327 | // against a declared read method, so we prefer read method descriptors here. |
323 | 328 | pd = buildGenericTypeAwarePropertyDescriptor(beanClass, pd); |
| 329 | + if (pd.getPropertyType() != null && (ClassLoader.class.isAssignableFrom(pd.getPropertyType()) |
| 330 | + || ProtectionDomain.class.isAssignableFrom(pd.getPropertyType()))) { |
| 331 | + // Ignore ClassLoader and ProtectionDomain types - nobody needs to bind to those |
| 332 | + continue; |
| 333 | + } |
324 | 334 | this.propertyDescriptors.put(pd.getName(), pd); |
325 | 335 | } |
326 | 336 | } |
|
0 commit comments