ServerWebInputException is throw each time Http request with mandatory request parameters is handled. [SPR-17338] #21872
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
status: backported
An issue that has been backported to maintenance branches
type: enhancement
A general enhancement
Milestone
Dmytro Mrachkovskyi opened SPR-17338 and commented
ServerWebInputException is throw each time Http request with mandatory request parameters is handled in AbstractNamedValueArgumentResolver. Even though this does not brake request handling flow, exception (and stack trace) is generated each time and it has performance impact.
Root-cause:
In
switchIfEmpty takes default value as an argument. As for mandatory arguments there is no default value ServerWebInputException will be thrown in getDefaultValue() method and wrapped into Mono.error(ex). This error mono will never be used until mandatory request parameter exists, but Exception it self is crated when there is no need in it.
Fix. Default value should be evaluated only if request parameter is empty:
Affects: 5.0.9, 5.1 GA
Referenced from: commits 983bce1, 8422976
Backported to: 5.0.10
The text was updated successfully, but these errors were encountered: