STR-3168: Prefer getMethod() to getDeclaredMethod() so inherited methods can be invoked
git-svn-id: https://svn.apache.org/repos/asf/struts/struts1/trunk@744821 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/core/src/main/java/org/apache/struts/dispatcher/AbstractMethodResolver.java b/core/src/main/java/org/apache/struts/dispatcher/AbstractMethodResolver.java
index 59506c0..878f628 100644
--- a/core/src/main/java/org/apache/struts/dispatcher/AbstractMethodResolver.java
+++ b/core/src/main/java/org/apache/struts/dispatcher/AbstractMethodResolver.java
@@ -79,13 +79,13 @@
// Does the method accept nothing?
try {
- return actionClass.getDeclaredMethod(methodName, EMPTY_ARGUMENT_TYPES);
+ return actionClass.getMethod(methodName, EMPTY_ARGUMENT_TYPES);
} catch (NoSuchMethodException e) {
// continue
}
// Does the method accept the action context?
- return actionClass.getDeclaredMethod(methodName, ACTION_CONTEXT_ARGUMENT_TYPES);
+ return actionClass.getMethod(methodName, ACTION_CONTEXT_ARGUMENT_TYPES);
}
}
diff --git a/core/src/main/java/org/apache/struts/dispatcher/servlet/ServletMethodResolver.java b/core/src/main/java/org/apache/struts/dispatcher/servlet/ServletMethodResolver.java
index 083aa2e..92868c9 100644
--- a/core/src/main/java/org/apache/struts/dispatcher/servlet/ServletMethodResolver.java
+++ b/core/src/main/java/org/apache/struts/dispatcher/servlet/ServletMethodResolver.java
@@ -119,7 +119,7 @@
if (context instanceof ServletActionContext) {
try {
Class actionClass = context.getAction().getClass();
- return actionClass.getDeclaredMethod(methodName, new Class[] { ServletActionContext.class });
+ return actionClass.getMethod(methodName, new Class[] { ServletActionContext.class });
} catch (NoSuchMethodException e) {
// continue
}