Skip to content

OncePerRequestFilter.isAsyncDispatch may return a NPE #26602

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
slyoldfox opened this issue Feb 24, 2021 · 1 comment
Closed

OncePerRequestFilter.isAsyncDispatch may return a NPE #26602

slyoldfox opened this issue Feb 24, 2021 · 1 comment
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Milestone

Comments

@slyoldfox
Copy link

This is a follow-up ticket for as request in #26282 where OncePerRequestFilter.isAsyncDispatch might NPE.

In our case we were using a silly mockito mock in a test which was testing the MultiPartFilter integration

HttpServletRequest request = mock( HttpServletRequest.class );
HttpServletResponse response = mock( HttpServletResponse.class );

multipartFilter.doFilter( request, response, mock( FilterChain.class ) );
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Feb 24, 2021
@rstoyanchev rstoyanchev self-assigned this Feb 25, 2021
@rstoyanchev rstoyanchev added in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Feb 25, 2021
@rstoyanchev rstoyanchev added this to the 5.3.5 milestone Feb 25, 2021
@rstoyanchev
Copy link
Contributor

We can change it in this case because if you wanted an ASYNC dispatch, you'd have to set it up. Per contract however getDispatcherType() isn't supposed to return null. There are other places where we test for REQUEST and defaulting to "false" there wouldn't be a good idea.

This was referenced Mar 16, 2021
This was referenced Mar 17, 2021
lxbzmy pushed a commit to lxbzmy/spring-framework that referenced this issue Mar 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants