Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: Release 1.5, Release 1.5.1
-
Fix Version/s: Release 1.5.2, Release 1.6
-
Component/s: ActionBean Dispatching
-
Labels:None
-
Environment:Java 1.5.0_19
Description
A net.sourceforge.stripes.exception.StripesRuntimeException is thrown in error at:
net.sourceforge.stripes.controller.AnnotatedClassActionResolver.processMethods(AnnotatedClassActionResolver.java:226)
The exception message is "The ActionBean class <classname? declares multiple event handlers for event '<eventname>'"
This occurs when processing methods for an actionBean that overrides a super class handler with a method returning a subclass of the original method (eg RedirectResolution overriding Resolution). The reason for the error is that AnnotatedClassActionResolver.processMethods is not expecting class.getDeclaredMethods() to include bridge methods. I will attach a test case that displays the problem.
Workaround is to refactor subclasses to return Resolution rather than ForwardResolution, RedirectResolution etc but it's valid in Java to override methods this way so it should be supported ideally.
The solution is to change AnnotatedClassActionResolver.java, line 220 as follows:
if ( Modifier.isPublic(method.getModifiers()) && !method.isBridge() ) {
This test case demonstrates the issue. It passes when the above change to AnnotatedClassActionResolver.java is made.