You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2021/04/22 12:30:17 UTC

[httpcomponents-client] 01/01: HTTPCLIENT-2152: Fixed handling of unexpected unchecked exception by the async request retry exec interceptor

This is an automated email from the ASF dual-hosted git repository.

olegk pushed a commit to branch 5.0.x
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git

commit a024eaab70f0bc9f1fac7d306f7c5fabf89422c1
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Thu Apr 22 14:27:29 2021 +0200

    HTTPCLIENT-2152: Fixed handling of unexpected unchecked exception by the async request retry exec interceptor
---
 .../client5/http/impl/async/AsyncHttpRequestRetryExec.java | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncHttpRequestRetryExec.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncHttpRequestRetryExec.java
index 5dad5e8..451e1f7 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncHttpRequestRetryExec.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncHttpRequestRetryExec.java
@@ -150,15 +150,15 @@ public final class AsyncHttpRequestRetryExec implements AsyncExecChainHandler {
                             LOG.info("Recoverable I/O exception ({}) caught when processing request to {}",
                                     cause.getClass().getName(), route);
                         }
-                        scope.execRuntime.discardEndpoint();
-                        if (entityProducer != null) {
-                            entityProducer.releaseResources();
-                        }
-                        state.retrying = true;
-                        state.execCount++;
                         try {
+                            scope.execRuntime.discardEndpoint();
+                            if (entityProducer != null) {
+                                entityProducer.releaseResources();
+                            }
+                            state.retrying = true;
+                            state.execCount++;
                             internalExecute(state, request, entityProducer, scope, chain, asyncExecCallback);
-                        } catch (final IOException | HttpException ex) {
+                        } catch (final Exception ex) {
                             asyncExecCallback.failed(ex);
                         }
                         return;