Misc clean ups. (#200)

This commit is contained in:
Gary Gregory 2020-01-09 11:45:04 -05:00 committed by GitHub
parent 0812192f46
commit 071fa68a3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 19 additions and 26 deletions

View File

@ -74,11 +74,10 @@ public final class ConnectExceptionSupport {
final IOException ex = createConnectTimeoutException(cause, namedEndpoint, remoteAddresses);
ex.initCause(cause);
return ex;
} else {
final IOException ex = createHttpHostConnectException(cause, namedEndpoint, remoteAddresses);
ex.setStackTrace(cause.getStackTrace());
return ex;
}
final IOException ex = createHttpHostConnectException(cause, namedEndpoint, remoteAddresses);
ex.setStackTrace(cause.getStackTrace());
return ex;
} else {
return cause;
}

View File

@ -213,9 +213,8 @@ public final class HttpRoute implements RouteInfo, Cloneable {
Args.check(hop < hopcount, "Hop index exceeds tracked route length");
if (hop < hopcount - 1) {
return this.proxyChain.get(hop);
} else {
return this.targetHost;
}
return this.targetHost;
}
@Override

View File

@ -67,8 +67,7 @@ public class DecompressingEntity extends HttpEntityWrapper {
}
private InputStream getDecompressingStream() throws IOException {
final InputStream in = super.getContent();
return new LazyDecompressingInputStream(in, inputStreamFactory);
return new LazyDecompressingInputStream(super.getContent(), inputStreamFactory);
}
@Override

View File

@ -51,6 +51,7 @@ public class FormBodyPart extends MultipartPart {
return this.name;
}
@Override
public void addField(final String name, final String value) {
Args.notNull(name, "Field name");
super.addField(name, value);

View File

@ -77,9 +77,8 @@ public class DefaultRoutePlanner implements HttpRoutePlanner {
final boolean secure = target.getSchemeName().equalsIgnoreCase("https");
if (proxy == null) {
return new HttpRoute(target, determineLocalAddress(target, context), secure);
} else {
return new HttpRoute(target, determineLocalAddress(proxy, context), proxy, secure);
}
return new HttpRoute(target, determineLocalAddress(proxy, context), proxy, secure);
}
/**

View File

@ -106,9 +106,8 @@ public final class PublicSuffixMatcher {
final DomainType domainType = map.get(rule);
if (domainType == null) {
return false;
} else {
return expectedType == null || domainType.equals(expectedType);
}
return expectedType == null || domainType.equals(expectedType);
}
private boolean hasRule(final String rule, final DomainType expectedType) {

View File

@ -51,18 +51,17 @@ public final class RoutingSupport {
throw new ProtocolException("Protocol scheme is not specified");
}
return new HttpHost(scheme, authority);
} else {
try {
final URI requestURI = request.getUri();
if (requestURI.isAbsolute()) {
final HttpHost httpHost = URIUtils.extractHost(requestURI);
if (httpHost == null) {
throw new ProtocolException("URI does not specify a valid host name: " + requestURI);
}
return httpHost;
}
try {
final URI requestURI = request.getUri();
if (requestURI.isAbsolute()) {
final HttpHost httpHost = URIUtils.extractHost(requestURI);
if (httpHost == null) {
throw new ProtocolException("URI does not specify a valid host name: " + requestURI);
}
} catch (final URISyntaxException ignore) {
return httpHost;
}
} catch (final URISyntaxException ignore) {
}
return null;
}

View File

@ -101,9 +101,8 @@ public class ConscryptClientTlsStrategy extends AbstractClientTlsStrategy {
TlsDetails createTlsDetails(final SSLEngine sslEngine) {
if (Conscrypt.isConscrypt(sslEngine)) {
return new TlsDetails(sslEngine.getSession(), Conscrypt.getApplicationProtocol(sslEngine));
} else {
return null;
}
return null;
}
public static boolean isSupported() {

View File

@ -117,9 +117,8 @@ final class TlsSessionValidator {
final ProtocolVersion tls = TLS.parse(sslsession.getProtocol());
if (tls.greaterEquals(TLS.V_1_3.version)) {
return;
} else {
throw ex;
}
throw ex;
} catch (final ParseException ex2) {
throw ex;
}