You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by gg...@apache.org on 2018/08/05 17:33:40 UTC
httpcomponents-client git commit: Remove exceptions not thrown from
method signatures. Don't nest unnecessarily.
Repository: httpcomponents-client
Updated Branches:
refs/heads/4.5.x 8c3333b4d -> 3b4258817
Remove exceptions not thrown from method signatures. Don't nest
unnecessarily.
Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/commit/3b425881
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/tree/3b425881
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/diff/3b425881
Branch: refs/heads/4.5.x
Commit: 3b4258817aa188e45f3b064c0ea714fc9620ce91
Parents: 8c3333b
Author: Gary Gregory <gg...@apache.org>
Authored: Sun Aug 5 11:33:36 2018 -0600
Committer: Gary Gregory <gg...@apache.org>
Committed: Sun Aug 5 11:33:36 2018 -0600
----------------------------------------------------------------------
.../java/org/apache/http/impl/execchain/MainClientExec.java | 6 ++----
.../org/apache/http/impl/execchain/MinimalClientExec.java | 9 +++------
.../org/apache/http/impl/execchain/ResponseEntityProxy.java | 4 ++--
.../main/java/org/apache/http/impl/execchain/RetryExec.java | 3 +--
4 files changed, 8 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/3b425881/httpclient/src/main/java/org/apache/http/impl/execchain/MainClientExec.java
----------------------------------------------------------------------
diff --git a/httpclient/src/main/java/org/apache/http/impl/execchain/MainClientExec.java b/httpclient/src/main/java/org/apache/http/impl/execchain/MainClientExec.java
index 99dd347..271d796 100644
--- a/httpclient/src/main/java/org/apache/http/impl/execchain/MainClientExec.java
+++ b/httpclient/src/main/java/org/apache/http/impl/execchain/MainClientExec.java
@@ -178,9 +178,8 @@ public class MainClientExec implements ClientExecChain {
if (execAware.isAborted()) {
connRequest.cancel();
throw new RequestAbortedException("Request aborted");
- } else {
- execAware.setCancellable(connRequest);
}
+ execAware.setCancellable(connRequest);
}
final RequestConfig config = context.getRequestConfig();
@@ -336,9 +335,8 @@ public class MainClientExec implements ClientExecChain {
// connection not needed and (assumed to be) in re-usable state
connHolder.releaseConnection();
return new HttpResponseProxy(response, null);
- } else {
- return new HttpResponseProxy(response, connHolder);
}
+ return new HttpResponseProxy(response, connHolder);
} catch (final ConnectionShutdownException ex) {
final InterruptedIOException ioex = new InterruptedIOException(
"Connection has been shut down");
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/3b425881/httpclient/src/main/java/org/apache/http/impl/execchain/MinimalClientExec.java
----------------------------------------------------------------------
diff --git a/httpclient/src/main/java/org/apache/http/impl/execchain/MinimalClientExec.java b/httpclient/src/main/java/org/apache/http/impl/execchain/MinimalClientExec.java
index 113c695..e2fbcc0 100644
--- a/httpclient/src/main/java/org/apache/http/impl/execchain/MinimalClientExec.java
+++ b/httpclient/src/main/java/org/apache/http/impl/execchain/MinimalClientExec.java
@@ -146,9 +146,8 @@ public class MinimalClientExec implements ClientExecChain {
if (execAware.isAborted()) {
connRequest.cancel();
throw new RequestAbortedException("Request aborted");
- } else {
- execAware.setCancellable(connRequest);
}
+ execAware.setCancellable(connRequest);
}
final RequestConfig config = context.getRequestConfig();
@@ -174,9 +173,8 @@ public class MinimalClientExec implements ClientExecChain {
if (execAware.isAborted()) {
releaseTrigger.close();
throw new RequestAbortedException("Request aborted");
- } else {
- execAware.setCancellable(releaseTrigger);
}
+ execAware.setCancellable(releaseTrigger);
}
if (!managedConn.isOpen()) {
@@ -230,9 +228,8 @@ public class MinimalClientExec implements ClientExecChain {
// connection not needed and (assumed to be) in re-usable state
releaseTrigger.releaseConnection();
return new HttpResponseProxy(response, null);
- } else {
- return new HttpResponseProxy(response, releaseTrigger);
}
+ return new HttpResponseProxy(response, releaseTrigger);
} catch (final ConnectionShutdownException ex) {
final InterruptedIOException ioex = new InterruptedIOException(
"Connection has been shut down");
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/3b425881/httpclient/src/main/java/org/apache/http/impl/execchain/ResponseEntityProxy.java
----------------------------------------------------------------------
diff --git a/httpclient/src/main/java/org/apache/http/impl/execchain/ResponseEntityProxy.java b/httpclient/src/main/java/org/apache/http/impl/execchain/ResponseEntityProxy.java
index 7013e09..6f53c23 100644
--- a/httpclient/src/main/java/org/apache/http/impl/execchain/ResponseEntityProxy.java
+++ b/httpclient/src/main/java/org/apache/http/impl/execchain/ResponseEntityProxy.java
@@ -65,13 +65,13 @@ class ResponseEntityProxy extends HttpEntityWrapper implements EofSensorWatcher
}
}
- private void abortConnection() throws IOException {
+ private void abortConnection() {
if (this.connHolder != null) {
this.connHolder.abortConnection();
}
}
- public void releaseConnection() throws IOException {
+ public void releaseConnection() {
if (this.connHolder != null) {
this.connHolder.releaseConnection();
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/3b425881/httpclient/src/main/java/org/apache/http/impl/execchain/RetryExec.java
----------------------------------------------------------------------
diff --git a/httpclient/src/main/java/org/apache/http/impl/execchain/RetryExec.java b/httpclient/src/main/java/org/apache/http/impl/execchain/RetryExec.java
index 201733e..42039fb 100644
--- a/httpclient/src/main/java/org/apache/http/impl/execchain/RetryExec.java
+++ b/httpclient/src/main/java/org/apache/http/impl/execchain/RetryExec.java
@@ -118,9 +118,8 @@ public class RetryExec implements ClientExecChain {
route.getTargetHost().toHostString() + " failed to respond");
updatedex.setStackTrace(ex.getStackTrace());
throw updatedex;
- } else {
- throw ex;
}
+ throw ex;
}
}
}