Milos Cubrilo opened SPR-16604 and commented
RestTemplate.handleResponse calls ResponseErrorHandler.hasError(response) to check if it should delegate error handling to ResponseErrorHandler instance.
In case of an unknown status code, DefaultResponseErrorHandler.hasError swallows the exception thrown by DefaultResponseErrorHandler.getHttpStatusCode(response) and returns false.
This causes RestTemplate code to proceed with standard response handling, but without possibility to read message body, which has already been consumed during UnknownHttpStatusCodeException creation in DefaultResponseErrorHandler.getHttpStatusCode(response) call.
Affects: 4.3.14
Issue Links:
Referenced from: pull request #1742, and commits 3b3f27d, d95bbb6
Milos Cubrilo opened SPR-16604 and commented
RestTemplate.handleResponsecallsResponseErrorHandler.hasError(response)to check if it should delegate error handling toResponseErrorHandlerinstance.In case of an unknown status code,
DefaultResponseErrorHandler.hasErrorswallows the exception thrown byDefaultResponseErrorHandler.getHttpStatusCode(response)and returnsfalse.This causes
RestTemplatecode to proceed with standard response handling, but without possibility to read message body, which has already been consumed duringUnknownHttpStatusCodeExceptioncreation inDefaultResponseErrorHandler.getHttpStatusCode(response)call.Affects: 4.3.14
Issue Links:
Referenced from: pull request #1742, and commits 3b3f27d, d95bbb6