Skip to content

MockHttpServletResponse.getHeaderNames is incompatible with Servlet 3.0 [SPR-9885] #14518

@spring-projects-issues

Description

@spring-projects-issues

Joshua Spiewak opened SPR-9885 and commented

HttpServletResponse defines getHeaderNames as returning Collection<String>, while MockHttpServletResponse defines it as returning Set<String>.
Use of the interface with a concrete instance of the mock yields an AbstractMethodError.
Attached are a Maven pom.xml and Java class that compiles but when run yields the exception:

Exception in thread "main" java.lang.AbstractMethodError: org.springframework.mock.web.MockHttpServletResponse.getHeaderNames()Ljava/util/Collection;
	at Example.main(Example.java:9)

The closest existing issue that I could find is #13173 which covered getHeaders but not getHeaderNames.


Affects: 3.1.2

Attachments:

Referenced from: commits f9bb4b3, 5a773b7

Backported to: 3.1.4

0 votes, 5 watchers

Metadata

Metadata

Assignees

Labels

in: testIssues in the test modulein: 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