Add final modifier to local variables.
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1726971 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9d5dde271f
commit
ac5e71b6aa
|
@ -188,7 +188,7 @@ public class WindowsNegotiateScheme extends AuthSchemeBase {
|
|||
|
||||
final String targetName = getServicePrincipalName(context);
|
||||
response = getToken(null, null, targetName);
|
||||
} catch (RuntimeException ex) {
|
||||
} catch (final RuntimeException ex) {
|
||||
failAuthCleanup();
|
||||
if (ex instanceof Win32Exception) {
|
||||
throw new AuthenticationException("Authentication Failed", ex);
|
||||
|
@ -206,7 +206,7 @@ public class WindowsNegotiateScheme extends AuthSchemeBase {
|
|||
Sspi.SECBUFFER_TOKEN, continueTokenBytes);
|
||||
final String targetName = getServicePrincipalName(context);
|
||||
response = getToken(this.sspiContext, continueTokenBuffer, targetName);
|
||||
} catch (RuntimeException ex) {
|
||||
} catch (final RuntimeException ex) {
|
||||
failAuthCleanup();
|
||||
if (ex instanceof Win32Exception) {
|
||||
throw new AuthenticationException("Authentication Failed", ex);
|
||||
|
|
|
@ -59,7 +59,7 @@ public class WinHttpClients {
|
|||
if (os != null && os.contains("windows")) {
|
||||
try {
|
||||
return Sspi.MAX_TOKEN_SIZE > 0;
|
||||
} catch (Exception ignore) { // Likely ClassNotFound
|
||||
} catch (final Exception ignore) { // Likely ClassNotFound
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ class CloseableHttpResponseProxy implements InvocationHandler {
|
|||
try {
|
||||
CONSTRUCTOR = Proxy.getProxyClass(CloseableHttpResponseProxy.class.getClassLoader(),
|
||||
new Class<?>[] { CloseableHttpResponse.class }).getConstructor(new Class[] { InvocationHandler.class });
|
||||
} catch (NoSuchMethodException ex) {
|
||||
} catch (final NoSuchMethodException ex) {
|
||||
throw new IllegalStateException(ex);
|
||||
}
|
||||
}
|
||||
|
@ -94,11 +94,11 @@ class CloseableHttpResponseProxy implements InvocationHandler {
|
|||
public static CloseableHttpResponse newProxy(final HttpResponse original) {
|
||||
try {
|
||||
return (CloseableHttpResponse) CONSTRUCTOR.newInstance(new CloseableHttpResponseProxy(original));
|
||||
} catch (InstantiationException ex) {
|
||||
} catch (final InstantiationException ex) {
|
||||
throw new IllegalStateException(ex);
|
||||
} catch (InvocationTargetException ex) {
|
||||
} catch (final InvocationTargetException ex) {
|
||||
throw new IllegalStateException(ex);
|
||||
} catch (IllegalAccessException ex) {
|
||||
} catch (final IllegalAccessException ex) {
|
||||
throw new IllegalStateException(ex);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -284,7 +284,7 @@ public class RequestBuilder {
|
|||
if (!formParams.isEmpty()) {
|
||||
parameters = formParams;
|
||||
}
|
||||
} catch (IOException ignore) {
|
||||
} catch (final IOException ignore) {
|
||||
}
|
||||
} else {
|
||||
entity = originalEntity;
|
||||
|
|
|
@ -270,7 +270,7 @@ public class URIUtils {
|
|||
}
|
||||
try {
|
||||
return normalizeSyntax(resolved);
|
||||
} catch (URISyntaxException ex) {
|
||||
} catch (final URISyntaxException ex) {
|
||||
throw new IllegalArgumentException(ex);
|
||||
}
|
||||
}
|
||||
|
@ -381,7 +381,7 @@ public class URIUtils {
|
|||
if (!TextUtils.isBlank(host)) {
|
||||
try {
|
||||
target = new HttpHost(host, port, scheme);
|
||||
} catch (IllegalArgumentException ignore) {
|
||||
} catch (final IllegalArgumentException ignore) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -279,7 +279,7 @@ public class URLEncodedUtils {
|
|||
Args.notNull(buf, "Char array buffer");
|
||||
final TokenParser tokenParser = TokenParser.INSTANCE;
|
||||
final BitSet delimSet = new BitSet();
|
||||
for (char separator: separators) {
|
||||
for (final char separator: separators) {
|
||||
delimSet.set(separator);
|
||||
}
|
||||
final ParserCursor cursor = new ParserCursor(0, buf.length());
|
||||
|
|
|
@ -155,7 +155,7 @@ public abstract class AbstractVerifier implements X509HostnameVerifier {
|
|||
DefaultHostnameVerifier.normaliseAddress(host.toLowerCase(Locale.ROOT)) : host;
|
||||
|
||||
if (subjectAltList != null) {
|
||||
for (String subjectAlt: subjectAltList) {
|
||||
for (final String subjectAlt: subjectAltList) {
|
||||
final String normalizedAltSubject = InetAddressUtils.isIPv6Address(subjectAlt) ?
|
||||
DefaultHostnameVerifier.normaliseAddress(subjectAlt) : subjectAlt;
|
||||
if (matchIdentity(normalizedHost, normalizedAltSubject, strictWithSubDomains)) {
|
||||
|
@ -223,7 +223,7 @@ public abstract class AbstractVerifier implements X509HostnameVerifier {
|
|||
try {
|
||||
final String cn = DefaultHostnameVerifier.extractCN(subjectPrincipal);
|
||||
return cn != null ? new String[] { cn } : null;
|
||||
} catch (SSLException ex) {
|
||||
} catch (final SSLException ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -262,13 +262,13 @@ public final class DefaultHostnameVerifier implements HostnameVerifier {
|
|||
if (value != null) {
|
||||
return value.toString();
|
||||
}
|
||||
} catch (NoSuchElementException ignore) {
|
||||
} catch (NamingException ignore) {
|
||||
} catch (final NoSuchElementException ignore) {
|
||||
} catch (final NamingException ignore) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
} catch (InvalidNameException e) {
|
||||
} catch (final InvalidNameException e) {
|
||||
throw new SSLException(subjectPrincipal + " is not a valid X500 distinguished name");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -371,7 +371,7 @@ public class SSLConnectionSocketFactory implements LayeredConnectionSocketFactor
|
|||
// If supported protocols are not explicitly set, remove all SSL protocol versions
|
||||
final String[] allProtocols = sslsock.getEnabledProtocols();
|
||||
final List<String> enabledProtocols = new ArrayList<String>(allProtocols.length);
|
||||
for (String protocol: allProtocols) {
|
||||
for (final String protocol: allProtocols) {
|
||||
if (!protocol.startsWith("SSL")) {
|
||||
enabledProtocols.add(protocol);
|
||||
}
|
||||
|
@ -454,7 +454,7 @@ public class SSLConnectionSocketFactory implements LayeredConnectionSocketFactor
|
|||
}
|
||||
this.log.debug(" issuer alternative names: " + altNames);
|
||||
}
|
||||
} catch (Exception ignore) {
|
||||
} catch (final Exception ignore) {
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -64,12 +64,12 @@ public final class PublicSuffixMatcher {
|
|||
Args.notNull(domainType, "Domain type");
|
||||
Args.notNull(rules, "Domain suffix rules");
|
||||
this.rules = new ConcurrentHashMap<String, DomainType>(rules.size());
|
||||
for (String rule: rules) {
|
||||
for (final String rule: rules) {
|
||||
this.rules.put(rule, domainType);
|
||||
}
|
||||
this.exceptions = new ConcurrentHashMap<String, DomainType>();
|
||||
if (exceptions != null) {
|
||||
for (String exception: exceptions) {
|
||||
for (final String exception: exceptions) {
|
||||
this.exceptions.put(exception, domainType);
|
||||
}
|
||||
}
|
||||
|
@ -82,15 +82,15 @@ public final class PublicSuffixMatcher {
|
|||
Args.notNull(lists, "Domain suffix lists");
|
||||
this.rules = new ConcurrentHashMap<String, DomainType>();
|
||||
this.exceptions = new ConcurrentHashMap<String, DomainType>();
|
||||
for (PublicSuffixList list: lists) {
|
||||
for (final PublicSuffixList list: lists) {
|
||||
final DomainType domainType = list.getType();
|
||||
final List<String> rules = list.getRules();
|
||||
for (String rule: rules) {
|
||||
for (final String rule: rules) {
|
||||
this.rules.put(rule, domainType);
|
||||
}
|
||||
final List<String> exceptions = list.getExceptions();
|
||||
if (exceptions != null) {
|
||||
for (String exception: exceptions) {
|
||||
for (final String exception: exceptions) {
|
||||
this.exceptions.put(exception, domainType);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ public final class PublicSuffixMatcherLoader {
|
|||
if (url != null) {
|
||||
try {
|
||||
DEFAULT_INSTANCE = load(url);
|
||||
} catch (IOException ex) {
|
||||
} catch (final IOException ex) {
|
||||
// Should never happen
|
||||
final Log log = LogFactory.getLog(PublicSuffixMatcherLoader.class);
|
||||
if (log.isWarnEnabled()) {
|
||||
|
|
|
@ -205,7 +205,7 @@ public abstract class GGSSchemeBase extends AuthSchemeBase {
|
|||
//final DnsResolver dnsResolver = SystemDefaultDnsResolver.INSTANCE;
|
||||
//hostname = dnsResolver.resolveCanonicalHostname(host.getHostName());
|
||||
hostname = resolveCanonicalHostname(hostname);
|
||||
} catch (UnknownHostException ignore){
|
||||
} catch (final UnknownHostException ignore){
|
||||
}
|
||||
}
|
||||
if (this.stripPort) { // || host.getPort()==80 || host.getPort()==443) {
|
||||
|
|
|
@ -107,7 +107,7 @@ public class BasicAuthCache implements AuthCache {
|
|||
out.writeObject(authScheme);
|
||||
out.close();
|
||||
this.map.put(getKey(host), buf.toByteArray());
|
||||
} catch (IOException ex) {
|
||||
} catch (final IOException ex) {
|
||||
if (log.isWarnEnabled()) {
|
||||
log.warn("Unexpected I/O error while serializing auth scheme", ex);
|
||||
}
|
||||
|
@ -130,12 +130,12 @@ public class BasicAuthCache implements AuthCache {
|
|||
final AuthScheme authScheme = (AuthScheme) in.readObject();
|
||||
in.close();
|
||||
return authScheme;
|
||||
} catch (IOException ex) {
|
||||
} catch (final IOException ex) {
|
||||
if (log.isWarnEnabled()) {
|
||||
log.warn("Unexpected I/O error while de-serializing auth scheme", ex);
|
||||
}
|
||||
return null;
|
||||
} catch (ClassNotFoundException ex) {
|
||||
} catch (final ClassNotFoundException ex) {
|
||||
if (log.isWarnEnabled()) {
|
||||
log.warn("Unexpected error while de-serializing auth scheme", ex);
|
||||
}
|
||||
|
|
|
@ -1102,7 +1102,7 @@ public class HttpClientBuilder {
|
|||
if (!contentCompressionDisabled) {
|
||||
if (contentDecoderMap != null) {
|
||||
final RegistryBuilder<InputStreamFactory> b2 = RegistryBuilder.create();
|
||||
for (Map.Entry<String, InputStreamFactory> entry: contentDecoderMap.entrySet()) {
|
||||
for (final Map.Entry<String, InputStreamFactory> entry: contentDecoderMap.entrySet()) {
|
||||
b2.register(entry.getKey(), entry.getValue());
|
||||
}
|
||||
b.add(new ResponseContentEncoding(b2.build()));
|
||||
|
|
|
@ -69,7 +69,7 @@ public final class IdleConnectionEvictor {
|
|||
connectionManager.closeIdleConnections(maxIdleTimeMs, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
} catch (final Exception ex) {
|
||||
exception = ex;
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ class LoggingInputStream extends InputStream {
|
|||
wire.input(b);
|
||||
}
|
||||
return b;
|
||||
} catch (IOException ex) {
|
||||
} catch (final IOException ex) {
|
||||
wire.input("[read] I/O error: " + ex.getMessage());
|
||||
throw ex;
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ class LoggingInputStream extends InputStream {
|
|||
wire.input(b, 0, bytesRead);
|
||||
}
|
||||
return bytesRead;
|
||||
} catch (IOException ex) {
|
||||
} catch (final IOException ex) {
|
||||
wire.input("[read] I/O error: " + ex.getMessage());
|
||||
throw ex;
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ class LoggingInputStream extends InputStream {
|
|||
wire.input(b, off, bytesRead);
|
||||
}
|
||||
return bytesRead;
|
||||
} catch (IOException ex) {
|
||||
} catch (final IOException ex) {
|
||||
wire.input("[read] I/O error: " + ex.getMessage());
|
||||
throw ex;
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ class LoggingInputStream extends InputStream {
|
|||
public long skip(final long n) throws IOException {
|
||||
try {
|
||||
return super.skip(n);
|
||||
} catch (IOException ex) {
|
||||
} catch (final IOException ex) {
|
||||
wire.input("[skip] I/O error: " + ex.getMessage());
|
||||
throw ex;
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ class LoggingInputStream extends InputStream {
|
|||
public int available() throws IOException {
|
||||
try {
|
||||
return in.available();
|
||||
} catch (IOException ex) {
|
||||
} catch (final IOException ex) {
|
||||
wire.input("[available] I/O error : " + ex.getMessage());
|
||||
throw ex;
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ class LoggingInputStream extends InputStream {
|
|||
public void close() throws IOException {
|
||||
try {
|
||||
in.close();
|
||||
} catch (IOException ex) {
|
||||
} catch (final IOException ex) {
|
||||
wire.input("[close] I/O error: " + ex.getMessage());
|
||||
throw ex;
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ class LoggingOutputStream extends OutputStream {
|
|||
public void write(final int b) throws IOException {
|
||||
try {
|
||||
wire.output(b);
|
||||
} catch (IOException ex) {
|
||||
} catch (final IOException ex) {
|
||||
wire.output("[write] I/O error: " + ex.getMessage());
|
||||
throw ex;
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ class LoggingOutputStream extends OutputStream {
|
|||
try {
|
||||
wire.output(b);
|
||||
out.write(b);
|
||||
} catch (IOException ex) {
|
||||
} catch (final IOException ex) {
|
||||
wire.output("[write] I/O error: " + ex.getMessage());
|
||||
throw ex;
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ class LoggingOutputStream extends OutputStream {
|
|||
try {
|
||||
wire.output(b, off, len);
|
||||
out.write(b, off, len);
|
||||
} catch (IOException ex) {
|
||||
} catch (final IOException ex) {
|
||||
wire.output("[write] I/O error: " + ex.getMessage());
|
||||
throw ex;
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ class LoggingOutputStream extends OutputStream {
|
|||
public void flush() throws IOException {
|
||||
try {
|
||||
out.flush();
|
||||
} catch (IOException ex) {
|
||||
} catch (final IOException ex) {
|
||||
wire.output("[flush] I/O error: " + ex.getMessage());
|
||||
throw ex;
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ class LoggingOutputStream extends OutputStream {
|
|||
public void close() throws IOException {
|
||||
try {
|
||||
out.close();
|
||||
} catch (IOException ex) {
|
||||
} catch (final IOException ex) {
|
||||
wire.output("[close] I/O error: " + ex.getMessage());
|
||||
throw ex;
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ public abstract class AbstractCookieSpec implements CookieSpec {
|
|||
protected AbstractCookieSpec(final CommonCookieAttributeHandler... handlers) {
|
||||
super();
|
||||
this.attribHandlerMap = new ConcurrentHashMap<String, CookieAttributeHandler>(handlers.length);
|
||||
for (CommonCookieAttributeHandler handler: handlers) {
|
||||
for (final CommonCookieAttributeHandler handler: handlers) {
|
||||
this.attribHandlerMap.put(handler.getAttributeName(), handler);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -153,7 +153,7 @@ public class LaxExpiresHandler extends AbstractCookieAttributeHandler implements
|
|||
}
|
||||
}
|
||||
}
|
||||
} catch (NumberFormatException ignore) {
|
||||
} catch (final NumberFormatException ignore) {
|
||||
throw new MalformedCookieException("Invalid 'expires' attribute: " + value);
|
||||
}
|
||||
if (!foundTime || !foundDayOfMonth || !foundMonth || !foundYear) {
|
||||
|
|
|
@ -84,7 +84,7 @@ public class RFC6265CookieSpec implements CookieSpec {
|
|||
super();
|
||||
this.attribHandlers = handlers.clone();
|
||||
this.attribHandlerMap = new ConcurrentHashMap<String, CookieAttributeHandler>(handlers.length);
|
||||
for (CommonCookieAttributeHandler handler: handlers) {
|
||||
for (final CommonCookieAttributeHandler handler: handlers) {
|
||||
this.attribHandlerMap.put(handler.getAttributeName().toLowerCase(Locale.ROOT), handler);
|
||||
}
|
||||
this.tokenParser = TokenParser.INSTANCE;
|
||||
|
@ -172,7 +172,7 @@ public class RFC6265CookieSpec implements CookieSpec {
|
|||
attribMap.remove(ClientCookie.EXPIRES_ATTR);
|
||||
}
|
||||
|
||||
for (Map.Entry<String, String> entry: attribMap.entrySet()) {
|
||||
for (final Map.Entry<String, String> entry: attribMap.entrySet()) {
|
||||
final String paramName = entry.getKey();
|
||||
final String paramValue = entry.getValue();
|
||||
final CookieAttributeHandler handler = this.attribHandlerMap.get(paramName);
|
||||
|
|
|
@ -100,10 +100,10 @@ class ResponseEntityProxy extends HttpEntityWrapper implements EofSensorWatcher
|
|||
try {
|
||||
this.wrappedEntity.writeTo(outstream);
|
||||
releaseConnection();
|
||||
} catch (IOException ex) {
|
||||
} catch (final IOException ex) {
|
||||
abortConnection();
|
||||
throw ex;
|
||||
} catch (RuntimeException ex) {
|
||||
} catch (final RuntimeException ex) {
|
||||
abortConnection();
|
||||
throw ex;
|
||||
} finally {
|
||||
|
@ -118,10 +118,10 @@ class ResponseEntityProxy extends HttpEntityWrapper implements EofSensorWatcher
|
|||
// reading trailers after the response body:
|
||||
wrapped.close();
|
||||
releaseConnection();
|
||||
} catch (IOException ex) {
|
||||
} catch (final IOException ex) {
|
||||
abortConnection();
|
||||
throw ex;
|
||||
} catch (RuntimeException ex) {
|
||||
} catch (final RuntimeException ex) {
|
||||
abortConnection();
|
||||
throw ex;
|
||||
} finally {
|
||||
|
@ -144,10 +144,10 @@ class ResponseEntityProxy extends HttpEntityWrapper implements EofSensorWatcher
|
|||
throw ex;
|
||||
}
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
} catch (final IOException ex) {
|
||||
abortConnection();
|
||||
throw ex;
|
||||
} catch (RuntimeException ex) {
|
||||
} catch (final RuntimeException ex) {
|
||||
abortConnection();
|
||||
throw ex;
|
||||
} finally {
|
||||
|
|
|
@ -74,7 +74,7 @@ public class TestGZip {
|
|||
final OutputStream out = Mockito.mock(OutputStream.class);
|
||||
try {
|
||||
gzipe.writeTo(out);
|
||||
} catch (IOException ex) {
|
||||
} catch (final IOException ex) {
|
||||
Mockito.verify(out, Mockito.never()).close();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -264,7 +264,7 @@ public class TestDefaultHostnameVerifier {
|
|||
try {
|
||||
DefaultHostnameVerifier.matchIPv6Address(host1, Arrays.asList("2001:0db8:aaaa:bbbb:cccc::10"));
|
||||
Assert.fail("SSLException expected");
|
||||
} catch (SSLException expected) {
|
||||
} catch (final SSLException expected) {
|
||||
}
|
||||
final String host2 = "2001:0db8:aaaa:bbbb:cccc::1";
|
||||
DefaultHostnameVerifier.matchIPv6Address(host2, Arrays.asList("2001:0db8:aaaa:bbbb:cccc:0:0:0001"));
|
||||
|
@ -272,7 +272,7 @@ public class TestDefaultHostnameVerifier {
|
|||
try {
|
||||
DefaultHostnameVerifier.matchIPv6Address(host2, Arrays.asList("2001:0db8:aaaa:bbbb:cccc::10"));
|
||||
Assert.fail("SSLException expected");
|
||||
} catch (SSLException expected) {
|
||||
} catch (final SSLException expected) {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -289,12 +289,12 @@ public class TestDefaultHostnameVerifier {
|
|||
try {
|
||||
DefaultHostnameVerifier.extractCN("blah,blah");
|
||||
Assert.fail("SSLException expected");
|
||||
} catch (SSLException expected) {
|
||||
} catch (final SSLException expected) {
|
||||
}
|
||||
try {
|
||||
DefaultHostnameVerifier.extractCN("cn,o=blah");
|
||||
Assert.fail("SSLException expected");
|
||||
} catch (SSLException expected) {
|
||||
} catch (final SSLException expected) {
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ public class FormBodyPartBuilder {
|
|||
Asserts.notNull(this.body, "Content body");
|
||||
final Header headerCopy = new Header();
|
||||
final List<MinimalField> fields = this.header.getFields();
|
||||
for (MinimalField field: fields) {
|
||||
for (final MinimalField field: fields) {
|
||||
headerCopy.addField(field);
|
||||
}
|
||||
if (headerCopy.getField(MIME.CONTENT_DISPOSITION) == null) {
|
||||
|
|
Loading…
Reference in New Issue