Skip to content

HttpHeaders fails to return getAllow() if it was previously set to an empty collection [SPR-11917] #16536

@spring-projects-issues

Description

@spring-projects-issues
Collaborator

Oliver Drotbohm opened SPR-11917 and commented

HttpHeaders headers = new HttpHeaders();
headers.setAllow(Collections.<HttpMethod> emptySet());
headers.getAllow();

This throws an exception during the accessor call, as it can't create an HttpMethod instance from the empty String. It should rather return an empty Set instead.

java.lang.IllegalArgumentException: No enum constant org.springframework.http.HttpMethod.
  at java.lang.Enum.valueOf(Enum.java:236)
  at org.springframework.http.HttpMethod.valueOf(HttpMethod.java:27)
  at org.springframework.http.HttpHeaders.getAllow(HttpHeaders.java:229)
  …

Affects: 3.2.9, 4.0.5

Backported to: 3.2.10

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

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @bclozel@spring-projects-issues

      Issue actions

        HttpHeaders fails to return getAllow() if it was previously set to an empty collection [SPR-11917] · Issue #16536 · spring-projects/spring-framework