Skip to content
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

@RequestHeader HttpHeaders fails with NPE against null header value [SPR-14091] #18663

spring-issuemaster opened this issue Mar 27, 2016 · 1 comment


Copy link

@spring-issuemaster spring-issuemaster commented Mar 27, 2016

Izek Greenfield opened SPR-14091 and commented

@RequestMapping(method = Array[RequestMethod](RequestMethod.POST), consumes = Array[String](MediaType.APPLICATION_JSON_VALUE), produces = Array[String](MediaType.APPLICATION_JSON_VALUE))
     def  doPost(request: HttpServletRequest,
              @RequestHeader httpHeaders: HttpHeaders,
              @RequestBody body: String) = {

When I send request with null header:


Spring MVC failed with NPE in:

for (Iterator<String> iterator = webRequest.getHeaderNames(); iterator.hasNext();) {
                String headerName =;
                for (String headerValue : webRequest.getHeaderValues(headerName)) {
                    result.add(headerName, headerValue);

Affects: 3.2.16, 4.2.5

Issue Links:

  • #18734 NPE thrown when calling methods with an empty @Caching annotation

Backported to: 3.2.17


This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Mar 27, 2016

Juergen Hoeller commented

Good catch: getHeaderValues may return null, so we need to add an explicit check there. Done for 4.3 now; to be backported to 4.2.6 and 3.2.17.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.