-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Closed
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancementA general enhancement
Milestone
Description
Adam Michalik opened SPR-12854 and commented
Consider a REST controller with the following request mappings on methods:
@RequestMapping(method = GET, params = "!myParam")
public void methodA(){...}
@RequestMapping(method = GET, params = "myParam=a")
public void methodB(){...}
When a request is made with myParam=b it does not match either of the mappings and an UnsatisfiedServletRequestParameterException is thrown in RequestMappingInfoHandlerMapping. However, the message of the exception is indeterministic - sometimes it's
Parameter conditions "myParam=a" not met for actual request parameters: myParam={b}
and sometimes
Parameter conditions "!myParam" not met for actual request parameters: myParam={b}
In my case it depended on which method was invoked first with a correct request after the server restart.
This is due to the logic in RequestMappingInfoHandlerMapping#getRequestParams where only first matching RequestMappingInfo is processed and the set of partialMatches is a HashSet with indeterministic order.
Affects: 4.1.6
Referenced from: commits b6449ba
Metadata
Metadata
Assignees
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancementA general enhancement