Browse Source

Consistently pass param info to ServerWebInputException

Issue: SPR-17232
pull/2023/head
Rossen Stoyanchev 6 years ago
parent
commit
548126ddd8
  1. 5
      spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractMessageReaderArgumentResolver.java
  2. 5
      spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/MatrixVariableMethodArgumentResolver.java
  3. 4
      spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestHeaderMethodArgumentResolver.java

5
spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractMessageReaderArgumentResolver.java

@ -218,8 +218,9 @@ public abstract class AbstractMessageReaderArgumentResolver extends HandlerMetho @@ -218,8 +218,9 @@ public abstract class AbstractMessageReaderArgumentResolver extends HandlerMetho
new ServerWebInputException("Failed to read HTTP message", parameter, ex) : ex);
}
private ServerWebInputException handleMissingBody(MethodParameter param) {
return new ServerWebInputException("Request body is missing: " + param.getExecutable().toGenericString());
private ServerWebInputException handleMissingBody(MethodParameter parameter) {
String paramInfo = parameter.getExecutable().toGenericString();
return new ServerWebInputException("Request body is missing: " + paramInfo, parameter);
}
/**

5
spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/MatrixVariableMethodArgumentResolver.java

@ -120,8 +120,9 @@ public class MatrixVariableMethodArgumentResolver extends AbstractNamedValueSync @@ -120,8 +120,9 @@ public class MatrixVariableMethodArgumentResolver extends AbstractNamedValueSync
@Override
protected void handleMissingValue(String name, MethodParameter parameter) throws ServerWebInputException {
throw new ServerWebInputException("Missing matrix variable '" + name +
"' for method parameter of type " + parameter.getNestedParameterType().getSimpleName());
String paramInfo = parameter.getNestedParameterType().getSimpleName();
throw new ServerWebInputException("Missing matrix variable '" + name + "' " +
"for method parameter of type " + paramInfo, parameter);
}

4
spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestHeaderMethodArgumentResolver.java

@ -90,8 +90,8 @@ public class RequestHeaderMethodArgumentResolver extends AbstractNamedValueSyncA @@ -90,8 +90,8 @@ public class RequestHeaderMethodArgumentResolver extends AbstractNamedValueSyncA
@Override
protected void handleMissingValue(String name, MethodParameter parameter) {
String type = parameter.getNestedParameterType().getSimpleName();
throw new ServerWebInputException("Missing request header '" + name +
"' for method parameter of type " + type);
throw new ServerWebInputException("Missing request header '" + name + "' " +
"for method parameter of type " + type, parameter);
}

Loading…
Cancel
Save