File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
connectors/httpclient/src/main/java/org/openstack4j/connectors/httpclient Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change 1919public class HttpExecutorServiceImpl implements HttpExecutorService {
2020
2121 private static final String NAME = "Apache HttpClient Connector" ;
22-
22+
2323 /**
2424 * {@inheritDoc}
2525 */
@@ -58,17 +58,19 @@ 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- try
61+
62+ if (command .getRetries () == 0 && response .getStatusLine ().getStatusCode () == 401 && !command .getRequest ().getHeaders ().containsKey (ClientConstants .HEADER_OS4J_AUTH ))
6263 {
63- if ( command . getRetries () == 0 && response . getStatusLine (). getStatusCode () == 401 && ! command . getRequest (). getHeaders (). containsKey ( ClientConstants . HEADER_OS4J_AUTH ))
64+ try
6465 {
6566 OSAuthenticator .reAuthenticate ();
6667 command .getRequest ().getHeaders ().put (ClientConstants .HEADER_X_AUTH_TOKEN , OSClientSession .getCurrent ().getTokenId ());
6768 return invokeRequest (command .incrementRetriesAndReturn ());
69+ } finally {
70+ response .close ();
6871 }
69- } finally {
70- response .close ();
7172 }
73+
7274 return HttpResponseImpl .wrap (response );
7375 }
7476
You can’t perform that action at this time.
0 commit comments