Closed
Description
Michael Osipov opened SPR-10402 and commented
I have defined this method signature:
@RequestMapping(method = RequestMethod.GET, produces = { MediaType.APPLICATION_XML_VALUE,
"application/json;charset=UTF-8" })
public ResponseEntity<Object> searchProjects(@RequestParam(value = "q") String query,
@RequestParam("attributes") String[] attributes,
@RequestParam(value = "outputType", required = false, defaultValue = "hash") OutputType outputType)
throws MissingServletRequestParameterException
When I invoke this method either with:
GET /rest?q&attributes=one
or
GET /rest?q=&attributes=one
The query variable is always passed as empty string/null although its defined as required. MissingServletRequestParameterException
is not thrown.
I have attached a screenshot of the debugging session where one can inspect that case. I think the else if in lines 95 to 97 are incomplete.
Affects: 3.2.2
Attachments:
- debug.png (76.59 kB)
Issue Links:
- Optional parameter in web method now raises error, breaks compatibility with the past [SPR-10584] #15213 Optional parameter in web method now raises error, breaks compatibility with the past
- Revert change for SPR-10402 that allowed treating empty values as missing values [SPR-10578] #15207 Revert change for SPR-10402 that allowed treating empty values as missing values
Referenced from: commits 2d8315f, e39fe18, abfb439, d3eda09
0 votes, 7 watchers