You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Copilot (via GitHub)" <gi...@apache.org> on 2026/07/29 20:00:56 UTC

Re: [PR] Suppress case variants of mapped names in isPropertySuppressed [commons-beanutils]

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


##########
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:
   `SuppressPropertiesBeanIntrospector` only requires the collection itself to be non-null; it can still contain null entries. With the new capitalization comparison, a null suppressed name will now throw a `NullPointerException` in `capitalizePropertyName`, whereas previously it would just never match. Consider skipping null suppressed entries (or validating earlier) to keep this path robust.



-- 
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: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org