Closed
Description
Michael Osipov opened SPR-10180 and commented
I have this @RequestMapping
@RequestMapping(value = "/{project:[A-Z0-9_+\\.\\(\\)=\\- ]+}", method = RequestMethod.GET, produces = {
MediaType.APPLICATION_XML_VALUE, "application/json;charset=UTF-8" })
public ResponseEntity<Object> lookupProject(@PathVariable String project,
@RequestParam(value = "attributes", required = false) String[] attributes,
@RequestParam(value = "outputType", required = false, defaultValue = "HASH") OutputType outputType)
Where OutputType
is an enum with the values HASH and ARRAY.
In the following edge cases:
GET /.../TEST-PROJECT?outputType HTTP/1.1
GET /.../TEST-PROJECT?outputType= HTTP/1.1
The outputType
variable is not populated with the default value but a null
is assigned. The RequestParamMethodArgumentResolver
receives this as an empty string.
See the attached screenshot of the debugger.
If this cannot be reasonable fixed, add at least a paragraph to the docs that such edge cases exist.
Affects: 3.1.3, 3.2 GA
Attachments:
- empty value.png (119.78 kB)