Lorenzo Bernacchioni created WW-4738:
----------------------------------------
Summary: AnnotationValidationInterceptor : NullPointerException
when method is null
Key: WW-4738
URL: https://issues.apache.org/jira/browse/WW-4738
Project: Struts 2
Issue Type: Bug
Components: Core Interceptors
Affects Versions: 2.3.24
Reporter: Lorenzo Bernacchioni
Priority: Minor
In {{AnnotationValidationInterceptor}} class {{method}} can be null and
{{method.getName()}} throws a NullPointerException
{code}
protected String doIntercept(ActionInvocation invocation) throws Exception {
Object action = invocation.getAction();
if (action != null) {
Method method = getActionMethod(action.getClass(),
invocation.getProxy().getMethod());
Collection<Method> annotatedMethods =
AnnotationUtils.getAnnotatedMethods(action.getClass(), SkipValidation.class);
if (annotatedMethods.contains(method))
return invocation.invoke();
//check if method overwites an annotated method
Class clazz = action.getClass().getSuperclass();
while (clazz != null) {
annotatedMethods = AnnotationUtils.getAnnotatedMethods(clazz,
SkipValidation.class);
if (annotatedMethods != null) {
for (Method annotatedMethod : annotatedMethods) {
if (annotatedMethod.getName().equals(method.getName())
&&
Arrays.equals(annotatedMethod.getParameterTypes(), method.getParameterTypes())
&&
Arrays.equals(annotatedMethod.getExceptionTypes(), method.getExceptionTypes()))
return invocation.invoke();
}
}
clazz = clazz.getSuperclass();
}
}
return super.doIntercept(invocation);
}
{code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)