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:
Baljit Singh
2022-11-29 08:32:24 -05:00
committed by rstoyanchev
parent 955ca4d146
commit b1fdb148d0
4 changed files with 7 additions and 7 deletions

View File

@@ -111,7 +111,7 @@ public class ResponseStatusExceptionResolverTests {
}
@Test // SPR-12903
public void nestedException() throws Exception {
public void nestedException() {
Exception cause = new StatusCodeAndReasonMessageException();
TypeMismatchException ex = new TypeMismatchException("value", ITestBean.class, cause);
ModelAndView mav = exceptionResolver.resolveException(request, response, null, ex);
@@ -119,14 +119,14 @@ public class ResponseStatusExceptionResolverTests {
}
@Test
public void responseStatusException() throws Exception {
public void responseStatusException() {
ResponseStatusException ex = new ResponseStatusException(HttpStatus.BAD_REQUEST);
ModelAndView mav = exceptionResolver.resolveException(request, response, null, ex);
assertResolved(mav, 400, null);
}
@Test // SPR-15524
public void responseStatusExceptionWithReason() throws Exception {
public void responseStatusExceptionWithReason() {
ResponseStatusException ex = new ResponseStatusException(HttpStatus.BAD_REQUEST, "The reason");
ModelAndView mav = exceptionResolver.resolveException(request, response, null, ex);
assertResolved(mav, 400, "The reason");