rootvector2 commented on code in PR #431:
URL: https://github.com/apache/commons-beanutils/pull/431#discussion_r3681158782


##########
src/main/java/org/apache/commons/beanutils2/PropertyUtilsBean.java:
##########
@@ -1068,15 +1068,21 @@ private Object invokeMethod(final Method method, final 
Object bean, final Object
     /**
      * Tests whether a property name has been removed by a registered {@link 
SuppressPropertiesBeanIntrospector}. The mapped-descriptor fallback in
      * {@link #getPropertyDescriptor(Object, String)} bypasses the 
introspection pipeline, so suppressed mapped property names must be filtered 
explicitly.
+     * {@link MappedPropertyDescriptor} derives its accessor names from the 
capitalized property name, so names differing only in the case of their first
+     * character resolve the same accessors and are compared on that 
capitalized form here.
      *
      * @param name The property name to test.
      * @return {@code true} if the name is suppressed by an introspector.
      */
     private boolean isPropertySuppressed(final String name) {
+        final String base = 
MappedPropertyDescriptor.capitalizePropertyName(name);
         for (final BeanIntrospector introspector : introspectors) {
-            if (introspector instanceof SuppressPropertiesBeanIntrospector
-                    && ((SuppressPropertiesBeanIntrospector) 
introspector).getSuppressedProperties().contains(name)) {
-                return true;
+            if (introspector instanceof SuppressPropertiesBeanIntrospector) {
+                for (final String suppressed : 
((SuppressPropertiesBeanIntrospector) introspector).getSuppressedProperties()) {
+                    if 
(base.equals(MappedPropertyDescriptor.capitalizePropertyName(suppressed))) {

Review Comment:
   Good catch. `getSuppressedProperties` only guarantees the collection itself 
is non-null, so a null entry reached `capitalizePropertyName` and threw where 
the old `Set.contains` just never matched. Nulls are skipped in the loop now, 
with `testCustomIntrospectionSuppressedMappedPropertyNullEntry` covering it 
(NPEs without the guard).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to