Remove exceptions not thrown from method signatures. Don't nest

unnecessarily.
This commit is contained in:
Gary Gregory 2018-08-05 11:33:36 -06:00
parent 8c3333b4d5
commit 3b4258817a
4 changed files with 8 additions and 14 deletions

View File

@ -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");

View File

@ -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");

View File

@ -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();
}

View File

@ -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;
}
}
}