Avoid reference to HandlerMethod class in ServerErrorException

This breaks the package dependency cycle between web.server/web.method and makes ServerErrorException more generally applicable. Includes deprecation of the plain reason constructor variant, in favor of providing a Method or MethodParameter context (which MatrixVariableMethodArgumentResolver does now).
This commit is contained in:
Juergen Hoeller
2018-04-01 00:21:15 +02:00
parent 97735e4ffc
commit 66a3a82fb3
3 changed files with 34 additions and 29 deletions

View File

@@ -109,7 +109,7 @@ public class SyncInvocableHandlerMethod extends HandlerMethod {
Throwable ex = processor.getError();
if (ex != null) {
throw (ex instanceof ServerErrorException ? (ServerErrorException) ex :
new ServerErrorException("Failed to invoke: " + getShortLogMessage(), this, ex));
new ServerErrorException("Failed to invoke: " + getShortLogMessage(), getMethod(), ex));
}
return processor.peek();
}

View File

@@ -98,7 +98,8 @@ public class MatrixVariableMethodArgumentResolver extends AbstractNamedValueSync
String paramType = param.getNestedParameterType().getName();
throw new ServerErrorException(
"Found more than one match for URI path parameter '" + name +
"' for parameter type [" + paramType + "]. Use 'pathVar' attribute to disambiguate.");
"' for parameter type [" + paramType + "]. Use 'pathVar' attribute to disambiguate.",
param, null);
}
paramValues.addAll(params.get(name));
found = true;