This is an automated email from the ASF dual-hosted git repository.

rmaucher pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit e778623a7e9109e07fa25a254ffeec377e81da83
Author: opencode <[email protected]>
AuthorDate: Wed Sep 30 13:43:51 2026 +0200

    Merge branch '10.1.x' of [email protected]:apache/tomcat.git into 10.1.x
---
 .../catalina/deploy/NamingResourcesImpl.java       | 29 ++++++++++++++--------
 1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/java/org/apache/catalina/deploy/NamingResourcesImpl.java 
b/java/org/apache/catalina/deploy/NamingResourcesImpl.java
index 5d035343bf..f51f012c1d 100644
--- a/java/org/apache/catalina/deploy/NamingResourcesImpl.java
+++ b/java/org/apache/catalina/deploy/NamingResourcesImpl.java
@@ -1184,11 +1184,16 @@ public class NamingResourcesImpl extends 
LifecycleMBeanBase implements Serializa
     }
 
     private Class<?> getSetterType(Class<?> clazz, String name) {
-        Method[] methods = Introspection.getDeclaredMethods(clazz);
-        if (methods != null && methods.length > 0) {
-            for (Method method : methods) {
-                if (Introspection.isValidSetter(method) && 
Introspection.getPropertyName(method).equals(name)) {
-                    return method.getParameterTypes()[0];
+        // The runtime injection engine (DefaultInstanceManager) matches
+        // injection targets across the whole class hierarchy, so the checks
+        // here must do the same
+        for (Class<?> c = clazz; c != null; c = c.getSuperclass()) {
+            Method[] methods = Introspection.getDeclaredMethods(c);
+            if (methods != null && methods.length > 0) {
+                for (Method method : methods) {
+                    if (Introspection.isValidSetter(method) && 
Introspection.getPropertyName(method).equals(name)) {
+                        return method.getParameterTypes()[0];
+                    }
                 }
             }
         }
@@ -1196,14 +1201,16 @@ public class NamingResourcesImpl extends 
LifecycleMBeanBase implements Serializa
     }
 
     private Class<?> getFieldType(Class<?> clazz, String name) {
-        Field[] fields = Introspection.getDeclaredFields(clazz);
-        if (fields != null && fields.length > 0) {
-            for (Field field : fields) {
-                if (field.getName().equals(name)) {
-                    return field.getType();
+        for (Class<?> c = clazz; c != null; c = c.getSuperclass()) {
+            Field[] fields = Introspection.getDeclaredFields(c);
+            if (fields != null && fields.length > 0) {
+                for (Field field : fields) {
+                    if (field.getName().equals(name)) {
+                        return field.getType();
+                    }
                 }
             }
+            return null;
         }
-        return null;
     }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to