diff --git a/src/main/java/com/smartsheet/api/internal/http/DefaultHttpClient.java b/src/main/java/com/smartsheet/api/internal/http/DefaultHttpClient.java index b0ae28ea9..7cdad4df1 100644 --- a/src/main/java/com/smartsheet/api/internal/http/DefaultHttpClient.java +++ b/src/main/java/com/smartsheet/api/internal/http/DefaultHttpClient.java @@ -288,6 +288,7 @@ public HttpResponse request(HttpRequest smartsheetRequest) throws HttpClientExce this.releaseConnection(); } catch (ClientProtocolException e) { + this.releaseConnection(); logger.warn("ClientProtocolException " + e.getMessage()); logger.warn(LOG_ARG, RequestAndResponseData.of(apacheHttpRequest, requestEntityCopy, smartsheetResponse, responseEntityCopy, REQUEST_RESPONSE_SUMMARY)); @@ -305,6 +306,7 @@ public HttpResponse request(HttpRequest smartsheetRequest) throws HttpClientExce } throw new HttpClientException(ERROR_OCCURRED, e); } catch (NoHttpResponseException e) { + this.releaseConnection(); logger.warn("NoHttpResponseException {}", e.getMessage()); logger.warn(LOG_ARG, RequestAndResponseData.of(apacheHttpRequest, requestEntityCopy, smartsheetResponse, responseEntityCopy, REQUEST_RESPONSE_SUMMARY)); @@ -322,6 +324,7 @@ public HttpResponse request(HttpRequest smartsheetRequest) throws HttpClientExce } throw new HttpClientException(ERROR_OCCURRED, e); } catch (IOException e) { + this.releaseConnection(); logger.warn(LOG_ARG, RequestAndResponseData.of(apacheHttpRequest, requestEntityCopy, smartsheetResponse, responseEntityCopy, REQUEST_RESPONSE_SUMMARY)); throw new HttpClientException(ERROR_OCCURRED, e);