hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r653041 - in /httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http: auth/ client/ client/methods/ client/protocol/ client/utils/ conn/ conn/params/ conn/routing/ conn/scheme/ conn/ssl/ cookie/ impl/auth/ impl/client/ ...
Date Sat, 03 May 2008 10:39:32 GMT
Author: olegk
Date: Sat May  3 03:39:28 2008
New Revision: 653041

URL: http://svn.apache.org/viewvc?rev=653041&view=rev
Log:
HTTPCLIENT-770: code cleanups
Contributed by Paul Lindner <lindner at inuus.com>

Modified:
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/auth/UsernamePasswordCredentials.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/AuthState.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/methods/HttpEntityEnclosingRequestBase.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/methods/HttpOptions.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/protocol/RequestAddCookies.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/protocol/RequestDefaultHeaders.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/protocol/ResponseProcessCookies.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/utils/URIUtils.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/MultihomePlainSocketFactory.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/HttpRouteParams.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/routing/HttpRoute.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/scheme/PlainSocketFactory.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/ssl/AbstractVerifier.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/cookie/CookieOrigin.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/cookie/CookiePathComparator.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/auth/BasicScheme.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/auth/DigestScheme.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/auth/RFC2617Scheme.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/AbstractAuthenticationHandler.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/BasicCookieStore.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/BasicCredentialsProvider.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/DefaultClientRequestDirector.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/EntityEnclosingRequestWrapper.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/AbstractPoolEntry.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/DefaultClientConnection.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/SingleClientConnManager.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/Wire.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/AbstractConnPool.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/RouteSpecificPool.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/package.html
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BasicClientCookie.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BasicDomainHandler.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BasicPathHandler.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BasicSecureHandler.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BestMatchSpec.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BrowserCompatSpec.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/CookieSpecBase.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/DateUtils.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/NetscapeDomainHandler.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2109DomainHandler.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2109Spec.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2109VersionHandler.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2965DomainAttributeHandler.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2965Spec.java

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/auth/UsernamePasswordCredentials.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/auth/UsernamePasswordCredentials.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/auth/UsernamePasswordCredentials.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/auth/UsernamePasswordCredentials.java Sat May  3 03:39:28 2008
@@ -133,9 +133,9 @@
      */
     @Override
     public String toString() {
-        StringBuffer result = new StringBuffer();
+        StringBuilder result = new StringBuilder();
         result.append(this.userName);
-        result.append(":");
+        result.append(':');
         result.append((this.password == null) ? "null" : this.password);
         return result.toString();
     }

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/AuthState.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/AuthState.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/AuthState.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/AuthState.java Sat May  3 03:39:28 2008
@@ -45,13 +45,13 @@
 public class AuthState {
 
     /** Actual authentication scheme */
-    private AuthScheme authScheme = null;
+    private AuthScheme authScheme;
 
     /** Actual authentication scope */
-    private AuthScope authScope = null;
+    private AuthScope authScope;
     
     /** Credentials selected for authentication */
-    private Credentials credentials = null;
+    private Credentials credentials;
     
     /**
      * Default constructor.

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/methods/HttpEntityEnclosingRequestBase.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/methods/HttpEntityEnclosingRequestBase.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/methods/HttpEntityEnclosingRequestBase.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/methods/HttpEntityEnclosingRequestBase.java Sat May  3 03:39:28 2008
@@ -48,7 +48,7 @@
 abstract class HttpEntityEnclosingRequestBase 
     extends HttpRequestBase implements HttpEntityEnclosingRequest {
     
-    private HttpEntity entity = null;
+    private HttpEntity entity;
     
     public HttpEntityEnclosingRequestBase() {
         super();

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/methods/HttpOptions.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/methods/HttpOptions.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/methods/HttpOptions.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/methods/HttpOptions.java Sat May  3 03:39:28 2008
@@ -93,8 +93,8 @@
         while (it.hasNext()) {
             Header header = it.nextHeader();
             HeaderElement[] elements = header.getElements();
-            for (int i = 0; i < elements.length; i++) {
-                methods.add(elements[i].getName());
+            for (HeaderElement element : elements) {
+                methods.add(element.getName());
             }
         }
         return methods;

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/protocol/RequestAddCookies.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/protocol/RequestAddCookies.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/protocol/RequestAddCookies.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/protocol/RequestAddCookies.java Sat May  3 03:39:28 2008
@@ -149,8 +149,7 @@
         List<Cookie> cookies = cookieStore.getCookies();
         // Find cookies matching the given origin
         List<Cookie> matchedCookies = new ArrayList<Cookie>();
-        for (int i = 0; i < cookies.size(); i++) {
-            Cookie cookie = cookies.get(i);
+        for (Cookie cookie : cookies) {
             if (cookieSpec.match(cookie, cookieOrigin)) {
                 if (LOG.isDebugEnabled()) {
                     LOG.debug("Cookie " + cookie + " match " + cookieOrigin);
@@ -161,16 +160,15 @@
         // Generate Cookie request headers
         if (!matchedCookies.isEmpty()) {
             List<Header> headers = cookieSpec.formatCookies(matchedCookies);
-            for (int i = 0; i < headers.size(); i++) {
-                request.addHeader(headers.get(i));
+            for (Header header : headers) {
+                request.addHeader(header);
             }
         }
         
         int ver = cookieSpec.getVersion();
         if (ver > 0) {
             boolean needVersionHeader = false;
-            for (int i = 0; i < matchedCookies.size(); i++) {
-                Cookie cookie = matchedCookies.get(i);
+            for (Cookie cookie : matchedCookies) {
                 if (ver != cookie.getVersion()) {
                     needVersionHeader = true;
                 }

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/protocol/RequestDefaultHeaders.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/protocol/RequestDefaultHeaders.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/protocol/RequestDefaultHeaders.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/protocol/RequestDefaultHeaders.java Sat May  3 03:39:28 2008
@@ -33,7 +33,6 @@
 
 import java.io.IOException;
 import java.util.Collection;
-import java.util.Iterator;
 
 import org.apache.http.Header;
 import org.apache.http.HttpException;
@@ -66,8 +65,8 @@
         Collection<?> defHeaders = (Collection<?>) request.getParams().getParameter(
                 ClientPNames.DEFAULT_HEADERS);
         if (defHeaders != null) {
-            for (Iterator<?> it = defHeaders.iterator(); it.hasNext(); ) {
-                request.addHeader((Header) it.next());
+            for (Object defHeader : defHeaders) {
+                request.addHeader((Header) defHeader);
             }
         }
     }

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/protocol/ResponseProcessCookies.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/protocol/ResponseProcessCookies.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/protocol/ResponseProcessCookies.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/protocol/ResponseProcessCookies.java Sat May  3 03:39:28 2008
@@ -118,12 +118,11 @@
             Header header = iterator.nextHeader();
             try {
                 List<Cookie> cookies = cookieSpec.parse(header, cookieOrigin);
-                for (int c = 0; c < cookies.size(); c++) {
-                    Cookie cookie = cookies.get(c);
+                for (Cookie cookie : cookies) {
                     try {
                         cookieSpec.validate(cookie, cookieOrigin);
                         cookieStore.addCookie(cookie);
-                        
+
                         if (LOG.isDebugEnabled()) {
                             LOG.debug("Cookie accepted: \""
                                     + cookie + "\". ");

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/utils/URIUtils.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/utils/URIUtils.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/utils/URIUtils.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/utils/URIUtils.java Sat May  3 03:39:28 2008
@@ -86,22 +86,22 @@
             }
             buffer.append(host);
             if (port > 0) {
-                buffer.append(":");
+                buffer.append(':');
                 buffer.append(port);
             }
         }
         if (path == null || !path.startsWith("/")) {
-            buffer.append("/");
+            buffer.append('/');
         }
         if (path != null) {
             buffer.append(path);
         }
         if (query != null) {
-            buffer.append("?");
+            buffer.append('?');
             buffer.append(query);
         }
         if (fragment != null) {
-            buffer.append("#");
+            buffer.append('#');
             buffer.append(fragment);
         }
         return new URI(buffer.toString());

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/MultihomePlainSocketFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/MultihomePlainSocketFactory.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/MultihomePlainSocketFactory.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/MultihomePlainSocketFactory.java Sat May  3 03:39:28 2008
@@ -39,6 +39,7 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
+import java.util.Arrays;
 
 import org.apache.http.conn.scheme.PlainSocketFactory;
 import org.apache.http.conn.scheme.SocketFactory;
@@ -64,7 +65,7 @@
      * Gets the singleton instance of this class.
      * @return the one and only plain socket factory
      */
-    public static final MultihomePlainSocketFactory getSocketFactory() {
+    public static MultihomePlainSocketFactory getSocketFactory() {
         return DEFAULT_FACTORY;
     }
 
@@ -126,9 +127,7 @@
 
         InetAddress[] inetadrs = InetAddress.getAllByName(host);
         List<InetAddress> addresses = new ArrayList<InetAddress>(inetadrs.length);
-        for (InetAddress inetadr: inetadrs) {
-            addresses.add(inetadr);
-        }
+        addresses.addAll(Arrays.asList(inetadrs));
         Collections.shuffle(addresses);
 
         IOException lastEx = null;

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/HttpRouteParams.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/HttpRouteParams.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/HttpRouteParams.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/HttpRouteParams.java Sat May  3 03:39:28 2008
@@ -84,7 +84,7 @@
      * @return  the default proxy set in the argument parameters, or
      *          <code>null</code> if not set
      */
-    public final static HttpHost getDefaultProxy(HttpParams params) {
+    public static HttpHost getDefaultProxy(HttpParams params) {
         if (params == null) {
             throw new IllegalArgumentException("Parameters must not be null.");
         }
@@ -108,7 +108,7 @@
      *                  <code>null</code> by {@link #getDefaultProxy},
      *                  to allow for explicit unsetting in hierarchies.
      */
-    public final static void setDefaultProxy(HttpParams params,
+    public static void setDefaultProxy(HttpParams params,
                                              HttpHost proxy) {
         if (params == null) {
             throw new IllegalArgumentException("Parameters must not be null.");
@@ -128,7 +128,7 @@
      * @return  the forced route set in the argument parameters, or
      *          <code>null</code> if not set
      */
-    public final static HttpRoute getForcedRoute(HttpParams params) {
+    public static HttpRoute getForcedRoute(HttpParams params) {
         if (params == null) {
             throw new IllegalArgumentException("Parameters must not be null.");
         }
@@ -152,7 +152,7 @@
      *                  <code>null</code> by {@link #getForcedRoute},
      *                  to allow for explicit unsetting in hierarchies.
      */
-    public final static void setForcedRoute(HttpParams params,
+    public static void setForcedRoute(HttpParams params,
                                             HttpRoute route) {
         if (params == null) {
             throw new IllegalArgumentException("Parameters must not be null.");
@@ -173,7 +173,7 @@
      * @return  the local address set in the argument parameters, or
      *          <code>null</code> if not set
      */
-    public final static InetAddress getLocalAddress(HttpParams params) {
+    public static InetAddress getLocalAddress(HttpParams params) {
         if (params == null) {
             throw new IllegalArgumentException("Parameters must not be null.");
         }
@@ -191,7 +191,7 @@
      * @param params    the parameters in which to set the value
      * @param local     the value to set, may be <code>null</code>
      */
-    public final static void setLocalAddress(HttpParams params,
+    public static void setLocalAddress(HttpParams params,
                                              InetAddress local) {
         if (params == null) {
             throw new IllegalArgumentException("Parameters must not be null.");

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/routing/HttpRoute.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/routing/HttpRoute.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/routing/HttpRoute.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/routing/HttpRoute.java Sat May  3 03:39:28 2008
@@ -239,10 +239,10 @@
         if ((proxies == null) || (proxies.length < 1))
             return null;
 
-        for (int i=0; i<proxies.length; i++) {
-            if (proxies[i] == null)
+        for (HttpHost proxy : proxies) {
+            if (proxy == null)
                 throw new IllegalArgumentException
-                    ("Proxy chain may not contain null elements.");
+                        ("Proxy chain may not contain null elements.");
         }
 
         // copy the proxy chain, the traditional way
@@ -281,7 +281,7 @@
         if (hop >= hopcount)
             throw new IllegalArgumentException
                 ("Hop index " + hop +
-                 " exceeds route length " + hopcount +".");
+                 " exceeds route length " + hopcount);
 
         HttpHost result = null;
         if (hop < hopcount-1)
@@ -385,8 +385,7 @@
             hc ^= localAddress.hashCode();
         if (this.proxyChain != null) {
             hc ^= proxyChain.length;
-            for (int i=0; i<proxyChain.length; i++)
-                hc ^= proxyChain[i].hashCode();
+            for (HttpHost aProxyChain : proxyChain) hc ^= aProxyChain.hashCode();
         }
 
         if (this.secure)
@@ -422,8 +421,8 @@
             cab.append('s');
         cab.append("}->");
         if (this.proxyChain != null) {
-            for (int i=0; i<this.proxyChain.length; i++) {
-                cab.append(this.proxyChain[i]);
+            for (HttpHost aProxyChain : this.proxyChain) {
+                cab.append(aProxyChain);
                 cab.append("->");
             }
         }

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/scheme/PlainSocketFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/scheme/PlainSocketFactory.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/scheme/PlainSocketFactory.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/scheme/PlainSocketFactory.java Sat May  3 03:39:28 2008
@@ -57,7 +57,7 @@
      * Gets the singleton instance of this class.
      * @return the one and only plain socket factory
      */
-    public static final PlainSocketFactory getSocketFactory() {
+    public static PlainSocketFactory getSocketFactory() {
         return DEFAULT_FACTORY;
     }
 

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/ssl/AbstractVerifier.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/ssl/AbstractVerifier.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/ssl/AbstractVerifier.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/ssl/AbstractVerifier.java Sat May  3 03:39:28 2008
@@ -162,9 +162,9 @@
             names.add(cns[0]);
         }
         if(subjectAlts != null) {
-            for(int i = 0; i < subjectAlts.length; i++) {
-                if(subjectAlts[i] != null) {
-                    names.add(subjectAlts[i]);
+            for (String subjectAlt : subjectAlts) {
+                if (subjectAlt != null) {
+                    names.add(subjectAlt);
                 }
             }
         }
@@ -303,12 +303,11 @@
             cpe.printStackTrace();
         }
         if(c != null) {
-            Iterator<List<?>> it = c.iterator();
-            while(it.hasNext()) {
-                List<?> list = it.next();
+            for (List<?> aC : c) {
+                List<?> list = aC;
                 int type = ((Integer) list.get(0)).intValue();
                 // If type is 2, then we've got a dNSName
-                if(type == 2) {
+                if (type == 2) {
                     String s = (String) list.get(1);
                     subjectAltList.add(s);
                 }

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/cookie/CookieOrigin.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/cookie/CookieOrigin.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/cookie/CookieOrigin.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/cookie/CookieOrigin.java Sat May  3 03:39:28 2008
@@ -53,7 +53,7 @@
             throw new IllegalArgumentException(
                     "Host of origin may not be null");
         }
-        if (host.trim().equals("")) {
+        if (host.trim().length() == 0) {
             throw new IllegalArgumentException(
                     "Host of origin may not be blank");
         }
@@ -66,7 +66,7 @@
         }
         this.host = host.toLowerCase(Locale.ENGLISH);
         this.port = port;
-        if (!path.trim().equals("")) {
+        if (path.trim().length() != 0) {
             this.path = path;
         } else {
             this.path = "/";
@@ -93,15 +93,15 @@
     @Override
     public String toString() {
         StringBuilder buffer = new StringBuilder();
-        buffer.append("[");
+        buffer.append('[');
         if (this.secure) {
             buffer.append("(secure)");
         }
         buffer.append(this.host);
-        buffer.append(":");
+        buffer.append(':');
         buffer.append(Integer.toString(this.port));
         buffer.append(this.path);
-        buffer.append("]");
+        buffer.append(']');
         return buffer.toString();
     }
     

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/cookie/CookiePathComparator.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/cookie/CookiePathComparator.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/cookie/CookiePathComparator.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/cookie/CookiePathComparator.java Sat May  3 03:39:28 2008
@@ -58,7 +58,7 @@
             path = "/";
         }
         if (!path.endsWith("/")) {
-            path = path + "/";
+            path = path + '/';
         }
         return path;
     }

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/auth/BasicScheme.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/auth/BasicScheme.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/auth/BasicScheme.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/auth/BasicScheme.java Sat May  3 03:39:28 2008
@@ -120,7 +120,7 @@
      * 
      * @param credentials The set of credentials to be used for athentication
      * @param request The request being authenticated
-     * @throws InvalidCredentialsException if authentication credentials
+     * @throws org.apache.http.auth.InvalidCredentialsException if authentication credentials
      *         are not valid or not applicable for this authentication scheme
      * @throws AuthenticationException if authorization string cannot 
      *   be generated due to an authentication failure

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/auth/DigestScheme.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/auth/DigestScheme.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/auth/DigestScheme.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/auth/DigestScheme.java Sat May  3 03:39:28 2008
@@ -198,7 +198,7 @@
      * @param credentials A set of credentials to be used for athentication
      * @param request    The request being authenticated
      * 
-     * @throws InvalidCredentialsException if authentication credentials
+     * @throws org.apache.http.auth.InvalidCredentialsException if authentication credentials
      *         are not valid or not applicable for this authentication scheme
      * @throws AuthenticationException if authorization string cannot 
      *   be generated due to an authentication failure
@@ -242,10 +242,6 @@
     /**
      * Creates an MD5 response digest.
      * 
-     * @param uname Username
-     * @param pwd Password
-     * @param charset The credential charset
-     * 
      * @return The created digest as string. This will be the response tag's
      *         value in the Authentication HTTP header.
      * @throws AuthenticationException when MD5 is an unsupported algorithm
@@ -311,7 +307,7 @@
             //we do not have access to the entity-body or its hash
             //TODO: add Method ":" digest-uri-value ":" H(entity-body)      
         } else {
-            a2 = method + ":" + uri;
+            a2 = method + ':' + uri;
         }
         String md5a2 = encode(md5Helper.digest(EncodingUtils.getAsciiBytes(a2)));
 

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/auth/RFC2617Scheme.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/auth/RFC2617Scheme.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/auth/RFC2617Scheme.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/auth/RFC2617Scheme.java Sat May  3 03:39:28 2008
@@ -60,7 +60,7 @@
     /**
      * Authentication parameter map.
      */
-    private Map<String, String> params = null;
+    private Map<String, String> params;
 
     /**
      * Flag whether authenticating against a proxy.
@@ -131,8 +131,7 @@
         }
         
         this.params = new HashMap<String, String>(elements.length);
-        for (int i = 0; i < elements.length; i++) {
-            HeaderElement element = elements[i];
+        for (HeaderElement element : elements) {
             this.params.put(element.getName(), element.getValue());
         }
     }

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/AbstractAuthenticationHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/AbstractAuthenticationHandler.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/AbstractAuthenticationHandler.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/AbstractAuthenticationHandler.java Sat May  3 03:39:28 2008
@@ -33,7 +33,6 @@
 
 import java.util.Arrays;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
@@ -73,8 +72,7 @@
             final Header[] headers) throws MalformedChallengeException {
         
         Map<String, Header> map = new HashMap<String, Header>(headers.length);
-        for (int i = 0; i < headers.length; i++) {
-            Header header = headers[i];
+        for (Header header : headers) {
             CharArrayBuffer buffer;
             int pos;
             if (header instanceof FormattedHeader) {
@@ -125,9 +123,9 @@
         }
 
         AuthScheme authScheme = null;
-        for (Iterator<String> it = authPrefs.iterator(); it.hasNext(); ) {
-            String id = it.next();
+        for (String id : authPrefs) {
             Header challenge = challenges.get(id.toLowerCase(Locale.ENGLISH)); 
+
             if (challenge != null) {
                 if (LOG.isDebugEnabled()) {
                     LOG.debug(id + " authentication scheme selected");

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/BasicCookieStore.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/BasicCookieStore.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/BasicCookieStore.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/BasicCookieStore.java Sat May  3 03:39:28 2008
@@ -109,8 +109,8 @@
      */
     public synchronized void addCookies(Cookie[] cookies) {
         if (cookies != null) {
-            for (int i = 0; i < cookies.length; i++) {
-                this.addCookie(cookies[i]);
+            for (Cookie cooky : cookies) {
+                this.addCookie(cooky);
             }
         }
     }

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/BasicCredentialsProvider.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/BasicCredentialsProvider.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/BasicCredentialsProvider.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/BasicCredentialsProvider.java Sat May  3 03:39:28 2008
@@ -85,7 +85,7 @@
      * Find matching {@link Credentials credentials} for the given authentication scope.
      *
      * @param map the credentials hash map
-     * @param token the {@link AuthScope authentication scope}
+     * @param authscope the {@link AuthScope authentication scope}
      * @return the credentials 
      * 
      */

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/DefaultClientRequestDirector.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/DefaultClientRequestDirector.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/DefaultClientRequestDirector.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/DefaultClientRequestDirector.java Sat May  3 03:39:28 2008
@@ -761,7 +761,7 @@
         
         StringBuilder buffer = new StringBuilder(host.length() + 6);
         buffer.append(host);
-        buffer.append(":");
+        buffer.append(':');
         buffer.append(Integer.toString(port));
         
         String authority = buffer.toString();

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/EntityEnclosingRequestWrapper.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/EntityEnclosingRequestWrapper.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/EntityEnclosingRequestWrapper.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/EntityEnclosingRequestWrapper.java Sat May  3 03:39:28 2008
@@ -54,7 +54,7 @@
 class EntityEnclosingRequestWrapper extends RequestWrapper 
     implements HttpEntityEnclosingRequest {
     
-    private HttpEntity entity = null;
+    private HttpEntity entity;
     
     public EntityEnclosingRequestWrapper(final HttpEntityEnclosingRequest request) 
         throws ProtocolException {

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/AbstractPoolEntry.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/AbstractPoolEntry.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/AbstractPoolEntry.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/AbstractPoolEntry.java Sat May  3 03:39:28 2008
@@ -90,7 +90,7 @@
     /**
      * Creates a new pool entry.
      *
-     * @param occ     the underlying connection for this entry
+     * @param connOperator     the Connection Operator for this entry
      * @param route   the planned route for the connection,
      *                or <code>null</code>
      */

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/DefaultClientConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/DefaultClientConnection.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/DefaultClientConnection.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/DefaultClientConnection.java Sat May  3 03:39:28 2008
@@ -223,8 +223,8 @@
         if (HEADERS_LOG.isDebugEnabled()) {
             HEADERS_LOG.debug("<< " + response.getStatusLine().toString());
             Header[] headers = response.getAllHeaders();
-            for (int i = 0; i < headers.length; i++) {
-                HEADERS_LOG.debug("<< " + headers[i].toString());
+            for (Header header : headers) {
+                HEADERS_LOG.debug("<< " + header.toString());
             }
         }
         return response;
@@ -237,8 +237,8 @@
         if (HEADERS_LOG.isDebugEnabled()) {
             HEADERS_LOG.debug(">> " + request.getRequestLine().toString());
             Header[] headers = request.getAllHeaders();
-            for (int i = 0; i < headers.length; i++) {
-                HEADERS_LOG.debug(">> " + headers[i].toString());
+            for (Header header : headers) {
+                HEADERS_LOG.debug(">> " + header.toString());
             }
         }
     }

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/SingleClientConnManager.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/SingleClientConnManager.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/SingleClientConnManager.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/SingleClientConnManager.java Sat May  3 03:39:28 2008
@@ -361,7 +361,6 @@
         /**
          * Creates a new pool entry.
          *
-         * @param occ   the underlying connection for this entry
          */
         protected PoolEntry() {
             super(SingleClientConnManager.this.connOperator, null);
@@ -403,7 +402,7 @@
          * Creates a new connection adapter.
          *
          * @param entry   the pool entry for the connection being wrapped
-         * @param plan    the planned route for this connection
+         * @param route   the planned route for this connection
          */
         protected ConnAdapter(PoolEntry entry, HttpRoute route) {
             super(SingleClientConnManager.this, entry);

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/Wire.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/Wire.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/Wire.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/Wire.java Sat May  3 03:39:28 2008
@@ -52,7 +52,7 @@
     
     private void wire(String header, InputStream instream)
       throws IOException {
-        StringBuffer buffer = new StringBuffer();
+        StringBuilder buffer = new StringBuilder();
         int ch;
         while ((ch = instream.read()) != -1) {
             if (ch == 13) {
@@ -72,8 +72,8 @@
             }
         } 
         if (buffer.length() > 0) {
-            buffer.append("\"");
-            buffer.insert(0, "\"");
+            buffer.append('\"');
+            buffer.insert(0, '\"');
             buffer.insert(0, header);
             log.debug(buffer.toString());
         }

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/AbstractConnPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/AbstractConnPool.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/AbstractConnPool.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/AbstractConnPool.java Sat May  3 03:39:28 2008
@@ -97,8 +97,6 @@
 
     /**
      * Creates a new connection pool.
-     *
-     * @param mgr   the connection manager
      */
     protected AbstractConnPool() {
         issuedConnections = new HashSet<BasicPoolEntryRef>();

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java Sat May  3 03:39:28 2008
@@ -251,8 +251,6 @@
      * @param timeout   the timeout, 0 or negative for no timeout
      * @param tunit     the unit for the <code>timeout</code>,
      *                  may be <code>null</code> only if there is no timeout
-     * @param operator  the connection operator, in case
-     *                  a connection has to be created
      * @param aborter   an object which can abort a {@link WaitingThread}.
      *
      * @return  pool entry holding a connection for the route

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/RouteSpecificPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/RouteSpecificPool.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/RouteSpecificPool.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/RouteSpecificPool.java Sat May  3 03:39:28 2008
@@ -62,10 +62,10 @@
      * This list is managed LIFO, to increase idle times and
      * allow for closing connections that are not really needed.
      */
-    protected LinkedList<BasicPoolEntry> freeEntries;
+    protected final LinkedList<BasicPoolEntry> freeEntries;
 
     /** The list of threads waiting for this pool. */
-    protected Queue<WaitingThread> waitingThreads;
+    protected final Queue<WaitingThread> waitingThreads;
 
     /** The number of created entries. */
     protected int numEntries;

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/package.html
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/package.html?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/package.html (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/package.html Sat May  3 03:39:28 2008
@@ -37,7 +37,7 @@
 The implementation of a thread-safe client connection manager.
 
 <center>
-<image src="doc-files/tsccm-structure.png" alt="Relation Diagram"/>
+<img src="doc-files/tsccm-structure.png" alt="Relation Diagram"/>
 </center>
 
 <p>
@@ -48,7 +48,7 @@
 Both Manager and Pool rely on <i>Operations</i> (cyan) to provide the
 actual connections.
 </p>
-</p>
+<p>
 In order to allow connection garbage collection, it is
 imperative that hard object references between the areas are
 restricted to the relations indicated by arrows in the diagram:

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BasicClientCookie.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BasicClientCookie.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BasicClientCookie.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BasicClientCookie.java Sat May  3 03:39:28 2008
@@ -363,7 +363,7 @@
     private boolean isSecure;
 
     /** The version of the cookie specification I was created from. */
-    private int cookieVersion = 0;
+    private int cookieVersion;
 
 }
 

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BasicDomainHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BasicDomainHandler.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BasicDomainHandler.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BasicDomainHandler.java Sat May  3 03:39:28 2008
@@ -50,7 +50,7 @@
         if (value == null) {
             throw new MalformedCookieException("Missing value for domain attribute");
         }
-        if (value.trim().equals("")) {
+        if (value.trim().length() == 0) {
             throw new MalformedCookieException("Blank value for domain attribute");
         }
         cookie.setDomain(value);
@@ -74,7 +74,7 @@
         if (domain == null) {
             throw new MalformedCookieException("Cookie domain may not be null");
         }
-        if (host.indexOf(".") >= 0) {
+        if (host.contains(".")) {
             // Not required to have at least two dots.  RFC 2965.
             // A Set-Cookie2 with Domain=ajax.com will be accepted.
 
@@ -114,7 +114,7 @@
             return true;
         }
         if (!domain.startsWith(".")) {
-            domain = "." + domain;
+            domain = '.' + domain;
         }
         return host.endsWith(domain) || host.equals(domain.substring(1));
     }

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BasicPathHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BasicPathHandler.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BasicPathHandler.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BasicPathHandler.java Sat May  3 03:39:28 2008
@@ -47,7 +47,7 @@
         if (cookie == null) {
             throw new IllegalArgumentException("Cookie may not be null");
         }
-        if (value == null || value.trim().equals("")) {
+        if (value == null || value.trim().length() == 0) {
             value = "/";
         }
         cookie.setPath(value);

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BasicSecureHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BasicSecureHandler.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BasicSecureHandler.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BasicSecureHandler.java Sat May  3 03:39:28 2008
@@ -57,7 +57,7 @@
         if (origin == null) {
             throw new IllegalArgumentException("Cookie origin may not be null");
         }
-        return cookie.isSecure() ? origin.isSecure() : true;
+        return !cookie.isSecure() || origin.isSecure();
     }
     
 }

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BestMatchSpec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BestMatchSpec.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BestMatchSpec.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BestMatchSpec.java Sat May  3 03:39:28 2008
@@ -53,9 +53,9 @@
     private final String[] datepatterns;
     private final boolean oneHeader;
     
-    private RFC2965Spec strict = null;
-    private BrowserCompatSpec compat = null;
-    private NetscapeDraftSpec netscape = null;
+    private RFC2965Spec strict;
+    private BrowserCompatSpec compat;
+    private NetscapeDraftSpec netscape;
 
     public BestMatchSpec(final String[] datepatterns, boolean oneHeader) {
         super();

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BrowserCompatSpec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BrowserCompatSpec.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BrowserCompatSpec.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/BrowserCompatSpec.java Sat May  3 03:39:28 2008
@@ -113,7 +113,7 @@
         int i1 = headervalue.toLowerCase(Locale.ENGLISH).indexOf("expires=");
         if (i1 != -1) {
             i1 += "expires=".length();
-            int i2 = headervalue.indexOf(";", i1);
+            int i2 = headervalue.indexOf(';', i1);
             if (i2 == -1) {
                 i2 = headervalue.length(); 
             }

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/CookieSpecBase.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/CookieSpecBase.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/CookieSpecBase.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/CookieSpecBase.java Sat May  3 03:39:28 2008
@@ -71,27 +71,25 @@
     protected List<Cookie> parse(final HeaderElement[] elems, final CookieOrigin origin)
                 throws MalformedCookieException {
         List<Cookie> cookies = new ArrayList<Cookie>(elems.length);
-        for (int i = 0; i < elems.length; i++) {
-            HeaderElement headerelement = elems[i];
-
+        for (HeaderElement headerelement : elems) {
             String name = headerelement.getName();
             String value = headerelement.getValue();
-            if (name == null || name.equals("")) {
+            if (name == null || name.length() == 0) {
                 throw new MalformedCookieException("Cookie name may not be empty");
             }
-            
+
             BasicClientCookie cookie = new BasicClientCookie(name, value);
             cookie.setPath(getDefaultPath(origin));
             cookie.setDomain(getDefaultDomain(origin));
-            
+
             // cycle through the parameters
             NameValuePair[] attribs = headerelement.getParameters();
             for (int j = attribs.length - 1; j >= 0; j--) {
                 NameValuePair attrib = attribs[j];
                 String s = attrib.getName().toLowerCase(Locale.ENGLISH);
-                
+
                 cookie.setAttribute(s, attrib.getValue());
-                
+
                 CookieAttributeHandler handler = findAttribHandler(s);
                 if (handler != null) {
                     handler.parse(cookie, attrib.getValue());

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/DateUtils.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/DateUtils.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/DateUtils.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/DateUtils.java Sat May  3 03:39:28 2008
@@ -151,16 +151,16 @@
         ) {
             dateValue = dateValue.substring (1, dateValue.length() - 1);
         }
-        
-        for (int i = 0; i < dateFormats.length; i++) {
-            SimpleDateFormat dateParser = DateFormatHolder.formatFor(dateFormats[i]);
+
+        for (String dateFormat : dateFormats) {
+            SimpleDateFormat dateParser = DateFormatHolder.formatFor(dateFormat);
             dateParser.set2DigitYearStart(startDate);
 
             try {
                 return dateParser.parse(dateValue);
             } catch (ParseException pe) {
                 // ignore this exception, we will try the next format
-            }                
+            }
         }
         
         // we were unable to parse the date

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/NetscapeDomainHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/NetscapeDomainHandler.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/NetscapeDomainHandler.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/NetscapeDomainHandler.java Sat May  3 03:39:28 2008
@@ -50,7 +50,7 @@
         // Perform Netscape Cookie draft specific validation
         String host = origin.getHost();
         String domain = cookie.getDomain();
-        if (host.indexOf(".") >= 0) {
+        if (host.contains(".")) {
             int domainParts = new StringTokenizer(domain, ".").countTokens();
 
             if (isSpecialDomain(domain)) {
@@ -78,16 +78,13 @@
     */
    private static boolean isSpecialDomain(final String domain) {
        final String ucDomain = domain.toUpperCase(Locale.ENGLISH);
-       if (ucDomain.endsWith(".COM") 
-          || ucDomain.endsWith(".EDU")
-          || ucDomain.endsWith(".NET")
-          || ucDomain.endsWith(".GOV")
-          || ucDomain.endsWith(".MIL")
-          || ucDomain.endsWith(".ORG")
-          || ucDomain.endsWith(".INT")) {
-           return true;
-       }
-       return false;
+       return ucDomain.endsWith(".COM")
+               || ucDomain.endsWith(".EDU")
+               || ucDomain.endsWith(".NET")
+               || ucDomain.endsWith(".GOV")
+               || ucDomain.endsWith(".MIL")
+               || ucDomain.endsWith(".ORG")
+               || ucDomain.endsWith(".INT");
    }
 
    @Override

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2109DomainHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2109DomainHandler.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2109DomainHandler.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2109DomainHandler.java Sat May  3 03:39:28 2008
@@ -52,7 +52,7 @@
         if (value == null) {
             throw new MalformedCookieException("Missing value for domain attribute");
         }
-        if (value.trim().equals("")) {
+        if (value.trim().length() == 0) {
             throw new MalformedCookieException("Blank value for domain attribute");
         }
         cookie.setDomain(value);

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2109Spec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2109Spec.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2109Spec.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2109Spec.java Sat May  3 03:39:28 2008
@@ -146,8 +146,7 @@
     private List<Header> doFormatOneHeader(final List<Cookie> cookies) {
         int version = Integer.MAX_VALUE;
         // Pick the lowest common denominator
-        for (int i = 0; i < cookies.size(); i++) {
-            Cookie cookie = cookies.get(i);
+        for (Cookie cookie : cookies) {
             if (cookie.getVersion() < version) {
                 version = cookie.getVersion();
             }
@@ -157,9 +156,9 @@
         buffer.append(": ");
         buffer.append("$Version=");
         buffer.append(Integer.toString(version));
-        for (int i = 0; i < cookies.size(); i++) {
+        for (Cookie cooky : cookies) {
             buffer.append("; ");
-            Cookie cookie = cookies.get(i);
+            Cookie cookie = cooky;
             formatCookieAsVer(buffer, cookie, version);
         }
         List<Header> headers = new ArrayList<Header>(1);
@@ -168,9 +167,8 @@
     }
 
     private List<Header> doFormatManyHeaders(final List<Cookie> cookies) {
-        List<Header> headers = new ArrayList<Header>(cookies.size()); 
-        for (int i = 0; i < cookies.size(); i++) {
-            Cookie cookie = cookies.get(i);
+        List<Header> headers = new ArrayList<Header>(cookies.size());
+        for (Cookie cookie : cookies) {
             int version = cookie.getVersion();
             CharArrayBuffer buffer = new CharArrayBuffer(40);
             buffer.append("Cookie: ");

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2109VersionHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2109VersionHandler.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2109VersionHandler.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2109VersionHandler.java Sat May  3 03:39:28 2008
@@ -49,7 +49,7 @@
         if (value == null) {
             throw new MalformedCookieException("Missing value for version attribute");
         }
-        if (value.trim().equals("")) {
+        if (value.trim().length() == 0) {
             throw new MalformedCookieException("Blank value for version attribute");
         }
         try {

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2965DomainAttributeHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2965DomainAttributeHandler.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2965DomainAttributeHandler.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2965DomainAttributeHandler.java Sat May  3 03:39:28 2008
@@ -65,7 +65,7 @@
             throw new MalformedCookieException(
                     "Missing value for domain attribute");
         }
-        if (domain.trim().equals("")) {
+        if (domain.trim().length() == 0) {
             throw new MalformedCookieException(
                     "Blank value for domain attribute");
         }
@@ -76,7 +76,7 @@
             // a dot, the user agent supplies a leading dot ..."
             // That effectively implies that the domain attribute 
             // MAY NOT be an IP address of a host name
-            domain = "." + domain;
+            domain = '.' + domain;
         }
         cookie.setDomain(domain);
     }
@@ -189,10 +189,7 @@
         // effective host name minus domain must not contain any dots
         String effectiveHostWithoutDomain = host.substring(
                 0, host.length() - cookieDomain.length());
-        if (effectiveHostWithoutDomain.indexOf('.') != -1) {
-            return false;
-        }
-        return true;
+        return effectiveHostWithoutDomain.indexOf('.') == -1;
     }
 
 }
\ No newline at end of file

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2965Spec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2965Spec.java?rev=653041&r1=653040&r2=653041&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2965Spec.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/cookie/RFC2965Spec.java Sat May  3 03:39:28 2008
@@ -108,12 +108,10 @@
         HeaderElement[] elems = header.getElements();
 
         List<Cookie> cookies = new ArrayList<Cookie>(elems.length);
-        for (int i = 0; i < elems.length; i++) {
-            HeaderElement headerelement = elems[i];
-
+        for (HeaderElement headerelement : elems) {
             String name = headerelement.getName();
             String value = headerelement.getValue();
-            if (name == null || name.equals("")) {
+            if (name == null || name.length() == 0) {
                 throw new MalformedCookieException("Cookie name may not be empty");
             }
 
@@ -123,24 +121,24 @@
             } else {
                 cookie = createCookie(name, value, origin);
             }
-            
+
             // cycle through the parameters
             NameValuePair[] attribs = headerelement.getParameters();
-            
+
             // Eliminate duplicate attributes. The first occurrence takes precedence
             // See RFC2965: 3.2  Origin Server Role
-            Map<String, NameValuePair> attribmap = 
-                new HashMap<String, NameValuePair>(attribs.length); 
+            Map<String, NameValuePair> attribmap =
+                    new HashMap<String, NameValuePair>(attribs.length);
             for (int j = attribs.length - 1; j >= 0; j--) {
                 NameValuePair param = attribs[j];
                 attribmap.put(param.getName().toLowerCase(Locale.ENGLISH), param);
             }
-            for (Map.Entry<String, NameValuePair> entry: attribmap.entrySet()) {
+            for (Map.Entry<String, NameValuePair> entry : attribmap.entrySet()) {
                 NameValuePair attrib = entry.getValue();
                 String s = attrib.getName().toLowerCase(Locale.ENGLISH);
-                
+
                 cookie.setAttribute(s, attrib.getValue());
-                
+
                 CookieAttributeHandler handler = findAttribHandler(s);
                 if (handler != null) {
                     handler.parse(cookie, attrib.getValue());
@@ -214,7 +212,7 @@
      * the effective host name is the same as the host name.  Note
      * that all effective host names contain at least one dot.
      *
-     * @param host host name where cookie is received from or being sent to.
+     * @param origin origin where cookie is received from or being sent to.
      * @return
      */
     private static CookieOrigin adjustEffectiveHost(final CookieOrigin origin) {



Mime
View raw message