Skip to content

Duplicated interceptors in HandlerExecutionChain after intermediate getInterceptors() call [SPR-12566] #17167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
spring-projects-issues opened this issue Dec 23, 2014 · 2 comments
Assignees
Labels
status: backported An issue that has been backported to maintenance branches type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

Juraj Bak opened SPR-12566 and commented

Method HandlerExecutionChain.initInterceptorList() duplicates interceptor records if attribute interceptorList contains previously added items resulting into duplicated interceptor calls.

Simple fix is to add this.interceptorList.clear() or initialize new Instance of list before line 104.
this.interceptorList.addAll(Arrays.asList(this.interceptors));
See attached source and test.

Btw. Is there a reason for convertion between collection and array? Class AbstractHandlerMapping works with collections, also a HandlerExecutionChain do so internally. But interface uses arrays and forces everybody to convert collections to arrays and back.


Affects: 3.2.12, 4.1.3

Attachments:

Referenced from: commits e353af6, 37713ae, 6b3023c

Backported to: 4.0.9, 3.2.13

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

The parallel handling of an array and a List there is primarily historical. I don't see a strong need to change this though (with this issue here fixed).

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

It's worth mentioning that this only happens with an intermediate {{getInterceptors()} call... The old implementation assumed that such a call would only come as a terminal operation at the very end. The revised implementation allows for such calls to happen at any point now.

Juergen

@spring-projects-issues spring-projects-issues added type: bug A general bug status: backported An issue that has been backported to maintenance branches labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 4.1.4 milestone Jan 11, 2019
This was referenced Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: backported An issue that has been backported to maintenance branches type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants