Test for change to add conversion of defaultValue

This commit adds a test and polishing for a change in
AbstractNamedValueMethodArgumentResolver erroneously committed
with (unrelated) commit e57b942b.

If an argument becomes null after conversion and a default value is
applied, that default value should also pass through conversion.

Closes gh-31336
This commit is contained in:
rstoyanchev
2023-10-24 12:23:51 +01:00
parent e0ac000415
commit 796080abb8
2 changed files with 18 additions and 2 deletions

View File

@@ -274,9 +274,10 @@ public abstract class AbstractNamedValueMethodArgumentResolver implements Handle
return value;
}
@Nullable
private static Object convertIfNecessary(
MethodParameter parameter, NativeWebRequest webRequest, WebDataBinderFactory binderFactory,
NamedValueInfo namedValueInfo, Object arg) throws Exception {
NamedValueInfo namedValueInfo, @Nullable Object arg) throws Exception {
WebDataBinder binder = binderFactory.createBinder(webRequest, null, namedValueInfo.name);
try {