ResponseStatusException delegates to protected constructor
This ensures that by default the reason is used to set the "detail"
field. It's a follow-up fix to a27f2e994b
which resolved the issue partially.
Closes gh-29608
This commit is contained in:
committed by
rstoyanchev
parent
955ca4d146
commit
b1fdb148d0
@@ -56,7 +56,9 @@ public class MethodNotAllowedException extends ResponseStatusException {
|
||||
}
|
||||
this.method = method;
|
||||
this.httpMethods = Collections.unmodifiableSet(new LinkedHashSet<>(supportedMethods));
|
||||
setDetail(this.httpMethods.isEmpty() ? getReason() : "Supported methods: " + this.httpMethods);
|
||||
if (!this.httpMethods.isEmpty()) {
|
||||
setDetail("Supported methods: " + this.httpMethods);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -42,7 +42,6 @@ public class MissingRequestValueException extends ServerWebInputException {
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
this.label = label;
|
||||
setDetail(getReason());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -76,8 +76,7 @@ public class ResponseStatusException extends ErrorResponseException {
|
||||
* @param cause a nested exception (optional)
|
||||
*/
|
||||
public ResponseStatusException(HttpStatusCode status, @Nullable String reason, @Nullable Throwable cause) {
|
||||
super(status, cause);
|
||||
this.reason = reason;
|
||||
this(status, reason, cause, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user