Skip to content

NullPointerException when FormContentFilter handles a request with no content type #23215

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
wilkinsona opened this issue Jun 29, 2019 · 0 comments
Assignees
Labels
type: bug A general bug
Milestone

Comments

@wilkinsona
Copy link
Member

Affects: 5.2.0 snapshots

A test is failing in Boot's build. I believe it is failing because FormContentFilter is filtering a request with no content type. In deciding if it should parse the request, it calls MediaType.parseMediaType(null) (null is the request's content type) which ultimately results in a NullPointerException:

22:14:41 java.lang.NullPointerException
22:14:41	java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:936)
22:14:41	org.springframework.util.MimeTypeUtils$ConcurrentLruCache.get(MimeTypeUtils.java:437)
22:14:41	org.springframework.util.MimeTypeUtils.parseMimeType(MimeTypeUtils.java:192)
22:14:41	org.springframework.http.MediaType.parseMediaType(MediaType.java:571)
22:14:41	org.springframework.web.filter.FormContentFilter.shouldParse(FormContentFilter.java:116)
22:14:41	org.springframework.web.filter.FormContentFilter.parseIfNecessary(FormContentFilter.java:98)
22:14:41	org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:87)
22:14:41	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109)
22:14:41	org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
22:14:41	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109)

I suspect that 5a308ad is the cause.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jun 29, 2019
@philwebb philwebb self-assigned this Jun 30, 2019
@philwebb philwebb added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Jun 30, 2019
@philwebb philwebb added this to the 5.2 RC1 milestone Jun 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants