Raise RestClientException for unknown status codes
HttpStatus cannot be created with an unknown status code. If a server
returns a status code that's not in the HttpStatus enum values, an
IllegalArgumentException is raised. Rather than allowing it to
propagate as such, this change ensures the actual exception raised is
a RestClientException.
Issue: SPR-9406
Backport-Issue: SPR-9502
@ -43,7 +45,18 @@ public class DefaultResponseErrorHandler implements ResponseErrorHandler {
@@ -43,7 +45,18 @@ public class DefaultResponseErrorHandler implements ResponseErrorHandler {
thrownewRestClientException("Unknown status code ["+response.getRawStatusCode()+"]");
}
returnstatusCode;
}
/**
@ -67,15 +80,16 @@ public class DefaultResponseErrorHandler implements ResponseErrorHandler {
@@ -67,15 +80,16 @@ public class DefaultResponseErrorHandler implements ResponseErrorHandler {
thrownewRestClientException("Unknown status code ["+statusCode+"]");
}
@ -83,15 +97,15 @@ public class DefaultResponseErrorHandler implements ResponseErrorHandler {
@@ -83,15 +97,15 @@ public class DefaultResponseErrorHandler implements ResponseErrorHandler {
@ -38,7 +43,8 @@ public class HttpClientErrorException extends HttpStatusCodeException {
@@ -38,7 +43,8 @@ public class HttpClientErrorException extends HttpStatusCodeException {
@ -47,18 +53,31 @@ public class HttpClientErrorException extends HttpStatusCodeException {
@@ -47,18 +53,31 @@ public class HttpClientErrorException extends HttpStatusCodeException {
@ -39,8 +43,8 @@ public class HttpServerErrorException extends HttpStatusCodeException {
@@ -39,8 +43,8 @@ public class HttpServerErrorException extends HttpStatusCodeException {
@ -49,19 +53,31 @@ public class HttpServerErrorException extends HttpStatusCodeException {
@@ -49,19 +53,31 @@ public class HttpServerErrorException extends HttpStatusCodeException {