[
http://www.stripesframework.org/jira/browse/STS-696?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11772#action_11772
]
Frederic Daoud commented on STS-696:
------------------------------------
Hi Paul,
I understand the issue and that the fix is simple, and it's great that you also
included a test to exercise the problem and solution. I'm just curious though:
can you explain why you need to return e.g. ForwardResolution instead of just
Resolution from your event handler method? Event handler methods are used by
Stripes; and even if you use them directly as well, ideally you'd work with the
interface, not with a specific implementation.
Let me know what you think.
Thanks,
Freddy
> StripesRuntimeException thrown in AnnotatedClassActionResolver when
> overriding handler but returning a subclass of the original method
> --------------------------------------------------------------------------------------------------------------------------------------
>
> Key: STS-696
> URL: http://www.stripesframework.org/jira/browse/STS-696
> Project: Stripes
> Issue Type: Bug
> Components: ActionBean Dispatching
> Affects Versions: Release 1.5, Release 1.5.1
> Environment: Java 1.5.0_19
> Reporter: Paul White
> Assignee: Frederic Daoud
> Attachments: AnnotatedClassActionResolverTest.java
>
>
> 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 message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://www.stripesframework.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development