Specific exception for missing request header, cookie, matrix variable

Issue: SPR-14818
This commit is contained in:
Juergen Hoeller
2018-07-18 18:56:51 +02:00
parent e8034f2f96
commit c77dbbb1e6
7 changed files with 219 additions and 8 deletions

View File

@@ -26,6 +26,7 @@ import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.util.MultiValueMap;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.MissingMatrixVariableException;
import org.springframework.web.bind.ServletRequestBindingException;
import org.springframework.web.bind.annotation.MatrixVariable;
import org.springframework.web.bind.annotation.ValueConstants;
@@ -122,8 +123,7 @@ public class MatrixVariableMethodArgumentResolver extends AbstractNamedValueMeth
@Override
protected void handleMissingValue(String name, MethodParameter parameter) throws ServletRequestBindingException {
throw new ServletRequestBindingException("Missing matrix variable '" + name +
"' for method parameter of type " + parameter.getNestedParameterType().getSimpleName());
throw new MissingMatrixVariableException(name, parameter);
}