Skip to content

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

@spring-projects-issues

Description

@spring-projects-issues

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:

ffff:

Spring MVC failed with NPE in: RequestHeaderMapMethodArgumentResolver.java:69

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

Affects: 3.2.16, 4.2.5

Issue Links:

Backported to: 3.2.17

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: backportedAn issue that has been backported to maintenance branchestype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions