File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
connectors/httpclient/src/main/java/org/openstack4j/connectors/httpclient Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -58,11 +58,16 @@ private <R> HttpResponse invoke(HttpRequest<R> request) throws Exception {
5858
5959 private <R > HttpResponse invokeRequest (HttpCommand <R > command ) throws Exception {
6060 CloseableHttpResponse response = command .execute ();
61- if ( command . getRetries () == 0 && response . getStatusLine (). getStatusCode () == 401 && ! command . getRequest (). getHeaders (). containsKey ( ClientConstants . HEADER_OS4J_AUTH ))
61+ try
6262 {
63- OSAuthenticator .reAuthenticate ();
64- command .getRequest ().getHeaders ().put (ClientConstants .HEADER_X_AUTH_TOKEN , OSClientSession .getCurrent ().getTokenId ());
65- return invokeRequest (command .incrementRetriesAndReturn ());
63+ if (command .getRetries () == 0 && response .getStatusLine ().getStatusCode () == 401 && !command .getRequest ().getHeaders ().containsKey (ClientConstants .HEADER_OS4J_AUTH ))
64+ {
65+ OSAuthenticator .reAuthenticate ();
66+ command .getRequest ().getHeaders ().put (ClientConstants .HEADER_X_AUTH_TOKEN , OSClientSession .getCurrent ().getTokenId ());
67+ return invokeRequest (command .incrementRetriesAndReturn ());
68+ }
69+ } finally {
70+ response .close ();
6671 }
6772 return HttpResponseImpl .wrap (response );
6873 }
You can’t perform that action at this time.
0 commit comments