Checkstyle fixes: Use final and tab police.
This commit is contained in:
parent
6156eb1f0f
commit
61529d1f88
|
@ -387,7 +387,7 @@ public class CachingHttpClient implements HttpClient {
|
|||
private <T> T handleAndConsume(
|
||||
final ResponseHandler<? extends T> responseHandler,
|
||||
final HttpResponse response) throws Error, IOException {
|
||||
T result;
|
||||
final T result;
|
||||
try {
|
||||
result = responseHandler.handleResponse(response);
|
||||
} catch (final Exception t) {
|
||||
|
@ -429,7 +429,7 @@ public class CachingHttpClient implements HttpClient {
|
|||
public HttpResponse execute(final HttpHost target, final HttpRequest originalRequest, final HttpContext context)
|
||||
throws IOException {
|
||||
|
||||
HttpRequestWrapper request;
|
||||
final HttpRequestWrapper request;
|
||||
if (originalRequest instanceof HttpRequestWrapper) {
|
||||
request = ((HttpRequestWrapper) originalRequest);
|
||||
} else {
|
||||
|
@ -693,7 +693,7 @@ public class CachingHttpClient implements HttpClient {
|
|||
final VersionInfo vi = VersionInfo.loadVersionInfo("org.apache.http.client", getClass().getClassLoader());
|
||||
final String release = (vi != null) ? vi.getRelease() : VersionInfo.UNAVAILABLE;
|
||||
|
||||
String value;
|
||||
final String value;
|
||||
if ("http".equalsIgnoreCase(pv.getProtocol())) {
|
||||
value = String.format("%d.%d localhost (Apache-HttpClient/%s (cache))", pv.getMajor(), pv.getMinor(),
|
||||
release);
|
||||
|
|
|
@ -155,7 +155,7 @@ class CacheKeyGenerator {
|
|||
}
|
||||
Collections.sort(variantHeaderNames);
|
||||
|
||||
StringBuilder buf;
|
||||
final StringBuilder buf;
|
||||
try {
|
||||
buf = new StringBuilder("{");
|
||||
boolean first = true;
|
||||
|
|
|
@ -527,7 +527,7 @@ public class CachingExec implements ClientExecChain {
|
|||
final VersionInfo vi = VersionInfo.loadVersionInfo("org.apache.http.client", getClass().getClassLoader());
|
||||
final String release = (vi != null) ? vi.getRelease() : VersionInfo.UNAVAILABLE;
|
||||
|
||||
String value;
|
||||
final String value;
|
||||
final int major = pv.getMajor();
|
||||
final int minor = pv.getMinor();
|
||||
if ("http".equalsIgnoreCase(pv.getProtocol())) {
|
||||
|
|
|
@ -68,7 +68,7 @@ public class HeapResourceFactory implements ResourceFactory {
|
|||
public Resource copy(
|
||||
final String requestId,
|
||||
final Resource resource) throws IOException {
|
||||
byte[] body;
|
||||
final byte[] body;
|
||||
if (resource instanceof HeapResource) {
|
||||
body = ((HeapResource) resource).getByteArray();
|
||||
} else {
|
||||
|
|
|
@ -58,7 +58,7 @@ public class MemcachedCacheEntryImpl implements MemcachedCacheEntry {
|
|||
@Override
|
||||
synchronized public byte[] toByteArray() {
|
||||
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
ObjectOutputStream oos;
|
||||
final ObjectOutputStream oos;
|
||||
try {
|
||||
oos = new ObjectOutputStream(bos);
|
||||
oos.writeObject(this.key);
|
||||
|
@ -92,9 +92,9 @@ public class MemcachedCacheEntryImpl implements MemcachedCacheEntry {
|
|||
@Override
|
||||
synchronized public void set(final byte[] bytes) {
|
||||
final ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
|
||||
ObjectInputStream ois;
|
||||
String s;
|
||||
HttpCacheEntry entry;
|
||||
final ObjectInputStream ois;
|
||||
final String s;
|
||||
final HttpCacheEntry entry;
|
||||
try {
|
||||
ois = new ObjectInputStream(bis);
|
||||
s = (String)ois.readObject();
|
||||
|
|
|
@ -155,7 +155,7 @@ public final class HttpProxyConfigurationActivator implements BundleActivator, M
|
|||
@Override
|
||||
public void updated(final String pid, @SuppressWarnings("rawtypes") final Dictionary config) throws ConfigurationException {
|
||||
final ServiceRegistration registration = registeredConfigurations.get(pid);
|
||||
OSGiProxyConfiguration proxyConfiguration;
|
||||
final OSGiProxyConfiguration proxyConfiguration;
|
||||
|
||||
if (registration == null) {
|
||||
proxyConfiguration = new OSGiProxyConfiguration();
|
||||
|
|
|
@ -203,7 +203,7 @@ public abstract class AbstractVerifier implements X509HostnameVerifier {
|
|||
final boolean doWildcard = parts.length >= 3 && parts[0].endsWith("*") &&
|
||||
(!strict || validCountryWildcard(parts));
|
||||
if (doWildcard) {
|
||||
boolean match;
|
||||
final boolean match;
|
||||
final String firstpart = parts[0];
|
||||
if (firstpart.length() > 1) { // e.g. server*
|
||||
final String prefix = firstpart.substring(0, firstpart.length() - 1); // e.g. server
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,96 +1,96 @@
|
|||
/*
|
||||
* ====================================================================
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.http.impl.auth;
|
||||
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
|
||||
/**
|
||||
* Simple debugging utility class for CredSSP and NTLM implementations.
|
||||
*/
|
||||
class DebugUtil
|
||||
{
|
||||
|
||||
public static String dump( final ByteBuffer buf )
|
||||
{
|
||||
final ByteBuffer dup = buf.duplicate();
|
||||
final StringBuilder sb = new StringBuilder( dup.toString() );
|
||||
sb.append( ": " );
|
||||
while ( dup.position() < dup.limit() )
|
||||
{
|
||||
sb.append( String.format( "%02X ", dup.get() ) );
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
public static void dump( final StringBuilder sb, final byte[] bytes )
|
||||
{
|
||||
if ( bytes == null )
|
||||
{
|
||||
sb.append( "null" );
|
||||
return;
|
||||
}
|
||||
for ( byte b : bytes )
|
||||
{
|
||||
sb.append( String.format( "%02X ", b ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static String dump( final byte[] bytes )
|
||||
{
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
dump( sb, bytes );
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
public static byte[] fromHex( final String hex )
|
||||
{
|
||||
int i = 0;
|
||||
final byte[] bytes = new byte[200000];
|
||||
int h = 0;
|
||||
while ( h < hex.length() )
|
||||
{
|
||||
if ( hex.charAt( h ) == ' ' )
|
||||
{
|
||||
h++;
|
||||
}
|
||||
final String str = hex.substring( h, h + 2 );
|
||||
bytes[i] = ( byte ) Integer.parseInt( str, 16 );
|
||||
i++;
|
||||
h = h + 2;
|
||||
}
|
||||
final byte[] outbytes = new byte[i];
|
||||
System.arraycopy( bytes, 0, outbytes, 0, i );
|
||||
return outbytes;
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* ====================================================================
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.http.impl.auth;
|
||||
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
|
||||
/**
|
||||
* Simple debugging utility class for CredSSP and NTLM implementations.
|
||||
*/
|
||||
class DebugUtil
|
||||
{
|
||||
|
||||
public static String dump( final ByteBuffer buf )
|
||||
{
|
||||
final ByteBuffer dup = buf.duplicate();
|
||||
final StringBuilder sb = new StringBuilder( dup.toString() );
|
||||
sb.append( ": " );
|
||||
while ( dup.position() < dup.limit() )
|
||||
{
|
||||
sb.append( String.format( "%02X ", dup.get() ) );
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
public static void dump( final StringBuilder sb, final byte[] bytes )
|
||||
{
|
||||
if ( bytes == null )
|
||||
{
|
||||
sb.append( "null" );
|
||||
return;
|
||||
}
|
||||
for ( final byte b : bytes )
|
||||
{
|
||||
sb.append( String.format( "%02X ", b ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static String dump( final byte[] bytes )
|
||||
{
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
dump( sb, bytes );
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
public static byte[] fromHex( final String hex )
|
||||
{
|
||||
int i = 0;
|
||||
final byte[] bytes = new byte[200000];
|
||||
int h = 0;
|
||||
while ( h < hex.length() )
|
||||
{
|
||||
if ( hex.charAt( h ) == ' ' )
|
||||
{
|
||||
h++;
|
||||
}
|
||||
final String str = hex.substring( h, h + 2 );
|
||||
bytes[i] = ( byte ) Integer.parseInt( str, 16 );
|
||||
i++;
|
||||
h = h + 2;
|
||||
}
|
||||
final byte[] outbytes = new byte[i];
|
||||
System.arraycopy( bytes, 0, outbytes, 0, i );
|
||||
return outbytes;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -821,7 +821,7 @@ final class NTLMEngineImpl implements NTLMEngine {
|
|||
|
||||
private Cipher initCipher() throws NTLMEngineException
|
||||
{
|
||||
Cipher cipher;
|
||||
final Cipher cipher;
|
||||
try
|
||||
{
|
||||
cipher = Cipher.getInstance( "RC4" );
|
||||
|
@ -834,7 +834,7 @@ final class NTLMEngineImpl implements NTLMEngine {
|
|||
cipher.init( Cipher.DECRYPT_MODE, new SecretKeySpec( sealingKey, "RC4" ) );
|
||||
}
|
||||
}
|
||||
catch ( Exception e )
|
||||
catch ( final Exception e )
|
||||
{
|
||||
throw new NTLMEngineException( e.getMessage(), e );
|
||||
}
|
||||
|
@ -1779,7 +1779,7 @@ final class NTLMEngineImpl implements NTLMEngine {
|
|||
writeUShort( newTargetInfo, MSV_AV_CHANNEL_BINDINGS, appendLength + 8 );
|
||||
writeUShort( newTargetInfo, 16, appendLength + 10 );
|
||||
|
||||
byte[] channelBindingsHash;
|
||||
final byte[] channelBindingsHash;
|
||||
try
|
||||
{
|
||||
final byte[] certBytes = peerServerCertificate.getEncoded();
|
||||
|
@ -1795,11 +1795,11 @@ final class NTLMEngineImpl implements NTLMEngine {
|
|||
final MessageDigest md5 = getMD5();
|
||||
channelBindingsHash = md5.digest( channelBindingStruct );
|
||||
}
|
||||
catch ( CertificateEncodingException e )
|
||||
catch ( final CertificateEncodingException e )
|
||||
{
|
||||
throw new NTLMEngineException( e.getMessage(), e );
|
||||
}
|
||||
catch ( NoSuchAlgorithmException e )
|
||||
catch ( final NoSuchAlgorithmException e )
|
||||
{
|
||||
throw new NTLMEngineException( e.getMessage(), e );
|
||||
}
|
||||
|
@ -1841,7 +1841,7 @@ final class NTLMEngineImpl implements NTLMEngine {
|
|||
static MessageDigest getMD5() {
|
||||
try {
|
||||
return MessageDigest.getInstance("MD5");
|
||||
} catch (NoSuchAlgorithmException ex) {
|
||||
} catch (final NoSuchAlgorithmException ex) {
|
||||
throw new RuntimeException("MD5 message digest doesn't seem to exist - fatal error: "+ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1216,7 +1216,7 @@ public class HttpClientBuilder {
|
|||
connectionEvictor.shutdown();
|
||||
try {
|
||||
connectionEvictor.awaitTermination(1L, TimeUnit.SECONDS);
|
||||
} catch (InterruptedException interrupted) {
|
||||
} catch (final InterruptedException interrupted) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@ public class RFC2109Spec extends CookieSpecBase {
|
|||
@Override
|
||||
public List<Header> formatCookies(final List<Cookie> cookies) {
|
||||
Args.notEmpty(cookies, "List of cookies");
|
||||
List<Cookie> cookieList;
|
||||
final List<Cookie> cookieList;
|
||||
if (cookies.size() > 1) {
|
||||
// Create a mutable copy and sort the copy.
|
||||
cookieList = new ArrayList<Cookie>(cookies);
|
||||
|
|
|
@ -316,7 +316,7 @@ public class TestHostnameVerifier {
|
|||
|
||||
@Test
|
||||
public void testHTTPCLIENT_1097() {
|
||||
String cns[];
|
||||
final String cns[];
|
||||
final String alt[] = {};
|
||||
final X509HostnameVerifier bhv = new BrowserCompatHostnameVerifier();
|
||||
final X509HostnameVerifier shv = new StrictHostnameVerifier();
|
||||
|
|
|
@ -76,7 +76,7 @@ public class TestNTLMEngineImpl {
|
|||
|
||||
/* Test suite MD4 helper */
|
||||
static void checkMD4(final String input, final String hexOutput) throws Exception {
|
||||
NTLMEngineImpl.MD4 md4;
|
||||
final NTLMEngineImpl.MD4 md4;
|
||||
md4 = new NTLMEngineImpl.MD4();
|
||||
md4.update(input.getBytes(Consts.ASCII));
|
||||
final byte[] answer = md4.getOutput();
|
||||
|
|
|
@ -89,7 +89,7 @@ public class EchoHandler
|
|||
|
||||
// For some reason, just putting the incoming entity into
|
||||
// the response will not work. We have to buffer the message.
|
||||
byte[] data;
|
||||
final byte[] data;
|
||||
if (entity == null) {
|
||||
data = new byte [0];
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue