hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1407076 [1/2] - in /httpcomponents: contrib/httpcore/trunk/src/main/java/org/apache/http/contrib/compress/ contrib/httpcore/trunk/src/main/java/org/apache/http/contrib/logging/ httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache...
Date Thu, 08 Nov 2012 13:46:27 GMT
Author: ggregory
Date: Thu Nov  8 13:46:24 2012
New Revision: 1407076

URL: http://svn.apache.org/viewvc?rev=1407076&view=rev
Log:
Use Java 5 enhanced 'for' loops.

Modified:
    httpcomponents/contrib/httpcore/trunk/src/main/java/org/apache/http/contrib/compress/ResponseGzipCompress.java
    httpcomponents/contrib/httpcore/trunk/src/main/java/org/apache/http/contrib/compress/ResponseGzipUncompress.java
    httpcomponents/contrib/httpcore/trunk/src/main/java/org/apache/http/contrib/logging/LoggingNHttpClientConnection.java
    httpcomponents/contrib/httpcore/trunk/src/main/java/org/apache/http/contrib/logging/LoggingNHttpServerConnection.java
    httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/conn/DefaultClientAsyncConnection.java
    httpcomponents/httpasyncclient/trunk/httpasyncclient/src/test/java/org/apache/http/nio/client/integration/TestStatefulConnManagement.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/URIUtils.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/routing/HttpRoute.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/routing/RouteTracker.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/NTLMEngineImpl.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965PortAttributeHandler.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/utils/TestURLEncodedUtils.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/auth/TestBasicScheme.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/auth/TestDigestScheme.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestConnectionReuse.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestIdleConnectionEviction.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestStatefulConnManagement.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/conn/ConnPoolBench.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/localserver/LocalTestServer.java
    httpcomponents/httpclient/trunk/httpmime/src/test/java/org/apache/http/entity/mime/TestMultipartForm.java
    httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/BenchmarkWorker.java
    httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/HttpBenchmark.java
    httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/ResultProcessor.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/BaseIOReactor.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultConnectingIOReactor.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultListeningIOReactor.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestSessionInOutBuffers.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestAsyncNHttpHandlers.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlers.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestThrottlingNHttpHandlers.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/LoggingNHttpClientConnection.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/LoggingNHttpServerConnection.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/DefaultHttpRequestFactory.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderElement.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderValueFormatter.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderValueParser.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/HeaderGroup.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/BasicHttpParams.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/ImmutableHttpProcessor.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/UriPatternMatcher.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/VersionInfo.java
    httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestStringEntity.java
    httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/TestEnglishReasonPhraseCatalog.java
    httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestSessionInOutBuffers.java
    httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/integration/TestSyncHttp.java
    httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestStandardInterceptors.java
    httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/testserver/LoggingBHttpClientConnection.java
    httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/testserver/LoggingBHttpServerConnection.java
    httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/util/TestByteArrayBuffer.java
    httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/util/TestEncodingUtils.java
    httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/util/TestEntityUtils.java

Modified: httpcomponents/contrib/httpcore/trunk/src/main/java/org/apache/http/contrib/compress/ResponseGzipCompress.java
URL: http://svn.apache.org/viewvc/httpcomponents/contrib/httpcore/trunk/src/main/java/org/apache/http/contrib/compress/ResponseGzipCompress.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/contrib/httpcore/trunk/src/main/java/org/apache/http/contrib/compress/ResponseGzipCompress.java (original)
+++ httpcomponents/contrib/httpcore/trunk/src/main/java/org/apache/http/contrib/compress/ResponseGzipCompress.java Thu Nov  8 13:46:24 2012
@@ -60,8 +60,8 @@ public class ResponseGzipCompress implem
             Header aeheader = request.getFirstHeader(ACCEPT_ENCODING);
             if (aeheader != null) {
                 HeaderElement[] codecs = aeheader.getElements();
-                for (int i = 0; i < codecs.length; i++) {
-                    if (codecs[i].getName().equalsIgnoreCase(GZIP_CODEC)) {
+                for (HeaderElement codec : codecs) {
+                    if (codec.getName().equalsIgnoreCase(GZIP_CODEC)) {
                         response.setEntity(new GzipCompressingEntity(entity));
                         return;
                     }

Modified: httpcomponents/contrib/httpcore/trunk/src/main/java/org/apache/http/contrib/compress/ResponseGzipUncompress.java
URL: http://svn.apache.org/viewvc/httpcomponents/contrib/httpcore/trunk/src/main/java/org/apache/http/contrib/compress/ResponseGzipUncompress.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/contrib/httpcore/trunk/src/main/java/org/apache/http/contrib/compress/ResponseGzipUncompress.java (original)
+++ httpcomponents/contrib/httpcore/trunk/src/main/java/org/apache/http/contrib/compress/ResponseGzipUncompress.java Thu Nov  8 13:46:24 2012
@@ -56,8 +56,8 @@ public class ResponseGzipUncompress impl
             Header ceheader = entity.getContentEncoding();
             if (ceheader != null) {
                 HeaderElement[] codecs = ceheader.getElements();
-                for (int i = 0; i < codecs.length; i++) {
-                    if (codecs[i].getName().equalsIgnoreCase(GZIP_CODEC)) {
+                for (HeaderElement codec : codecs) {
+                    if (codec.getName().equalsIgnoreCase(GZIP_CODEC)) {
                         response.setEntity(new GzipDecompressingEntity(response.getEntity()));
                         return;
                     }

Modified: httpcomponents/contrib/httpcore/trunk/src/main/java/org/apache/http/contrib/logging/LoggingNHttpClientConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/contrib/httpcore/trunk/src/main/java/org/apache/http/contrib/logging/LoggingNHttpClientConnection.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/contrib/httpcore/trunk/src/main/java/org/apache/http/contrib/logging/LoggingNHttpClientConnection.java (original)
+++ httpcomponents/contrib/httpcore/trunk/src/main/java/org/apache/http/contrib/logging/LoggingNHttpClientConnection.java Thu Nov  8 13:46:24 2012
@@ -114,8 +114,8 @@ public class LoggingNHttpClientConnectio
         if (response != null && this.headerlog.isDebugEnabled()) {
             this.headerlog.debug(this.id + " << " + response.getStatusLine().toString());
             Header[] headers = response.getAllHeaders();
-            for (int i = 0; i < headers.length; i++) {
-                this.headerlog.debug(this.id + " << " + headers[i].toString());
+            for (Header header : headers) {
+                this.headerlog.debug(this.id + " << " + header.toString());
             }
         }
     }
@@ -125,8 +125,8 @@ public class LoggingNHttpClientConnectio
         if (request != null && this.headerlog.isDebugEnabled()) {
             this.headerlog.debug(id + " >> " + request.getRequestLine().toString());
             Header[] headers = request.getAllHeaders();
-            for (int i = 0; i < headers.length; i++) {
-                this.headerlog.debug(this.id + " >> " + headers[i].toString());
+            for (Header header : headers) {
+                this.headerlog.debug(this.id + " >> " + header.toString());
             }
         }
     }

Modified: httpcomponents/contrib/httpcore/trunk/src/main/java/org/apache/http/contrib/logging/LoggingNHttpServerConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/contrib/httpcore/trunk/src/main/java/org/apache/http/contrib/logging/LoggingNHttpServerConnection.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/contrib/httpcore/trunk/src/main/java/org/apache/http/contrib/logging/LoggingNHttpServerConnection.java (original)
+++ httpcomponents/contrib/httpcore/trunk/src/main/java/org/apache/http/contrib/logging/LoggingNHttpServerConnection.java Thu Nov  8 13:46:24 2012
@@ -114,8 +114,8 @@ public class LoggingNHttpServerConnectio
         if (request != null && this.headerlog.isDebugEnabled()) {
             this.headerlog.debug(this.id + " >> " + request.getRequestLine().toString());
             Header[] headers = request.getAllHeaders();
-            for (int i = 0; i < headers.length; i++) {
-                this.headerlog.debug(this.id + " >> " + headers[i].toString());
+            for (Header header : headers) {
+                this.headerlog.debug(this.id + " >> " + header.toString());
             }
         }
     }
@@ -125,8 +125,8 @@ public class LoggingNHttpServerConnectio
         if (response != null && this.headerlog.isDebugEnabled()) {
             this.headerlog.debug(this.id + " << " + response.getStatusLine().toString());
             Header[] headers = response.getAllHeaders();
-            for (int i = 0; i < headers.length; i++) {
-                this.headerlog.debug(this.id + " << " + headers[i].toString());
+            for (Header header : headers) {
+                this.headerlog.debug(this.id + " << " + header.toString());
             }
         }
     }

Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/conn/DefaultClientAsyncConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/conn/DefaultClientAsyncConnection.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/conn/DefaultClientAsyncConnection.java (original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/conn/DefaultClientAsyncConnection.java Thu Nov  8 13:46:24 2012
@@ -86,8 +86,8 @@ public class DefaultClientAsyncConnectio
         if (response != null && this.headerlog.isDebugEnabled()) {
             this.headerlog.debug(this.id + " << " + response.getStatusLine().toString());
             Header[] headers = response.getAllHeaders();
-            for (int i = 0; i < headers.length; i++) {
-                this.headerlog.debug(this.id + " << " + headers[i].toString());
+            for (Header header : headers) {
+                this.headerlog.debug(this.id + " << " + header.toString());
             }
         }
     }
@@ -97,8 +97,8 @@ public class DefaultClientAsyncConnectio
         if (request != null && this.headerlog.isDebugEnabled()) {
             this.headerlog.debug(this.id + " >> " + request.getRequestLine().toString());
             Header[] headers = request.getAllHeaders();
-            for (int i = 0; i < headers.length; i++) {
-                this.headerlog.debug(this.id + " >> " + headers[i].toString());
+            for (Header header : headers) {
+                this.headerlog.debug(this.id + " >> " + header.toString());
             }
         }
     }

Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/test/java/org/apache/http/nio/client/integration/TestStatefulConnManagement.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/test/java/org/apache/http/nio/client/integration/TestStatefulConnManagement.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/test/java/org/apache/http/nio/client/integration/TestStatefulConnManagement.java (original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/test/java/org/apache/http/nio/client/integration/TestStatefulConnManagement.java Thu Nov  8 13:46:24 2012
@@ -166,22 +166,21 @@ public class TestStatefulConnManagement 
             workers[i] = new HttpWorker(context, requestCount, target, this.httpclient);
         }
 
-        for (int i = 0; i < workers.length; i++) {
-            workers[i].start();
+        for (HttpWorker worker : workers) {
+            worker.start();
         }
-        for (int i = 0; i < workers.length; i++) {
-            workers[i].join(10000);
+        for (HttpWorker worker : workers) {
+            worker.join(10000);
         }
-        for (int i = 0; i < workers.length; i++) {
-            Exception ex = workers[i].getException();
+        for (HttpWorker worker : workers) {
+            Exception ex = worker.getException();
             if (ex != null) {
                 throw ex;
             }
-            Assert.assertEquals(requestCount, workers[i].getCount());
+            Assert.assertEquals(requestCount, worker.getCount());
         }
 
-        for (int i = 0; i < contexts.length; i++) {
-            HttpContext context = contexts[i];
+        for (HttpContext context : contexts) {
             Integer id = (Integer) context.getAttribute("user");
 
             for (int r = 0; r < requestCount; r++) {

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/URIUtils.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/URIUtils.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/URIUtils.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/URIUtils.java Thu Nov  8 13:46:24 2012
@@ -252,16 +252,16 @@ public class URIUtils {
         }
         String[] inputSegments = path.split("/");
         Stack<String> outputSegments = new Stack<String>();
-        for (int i = 0; i < inputSegments.length; i++) {
-            if ((inputSegments[i].length() == 0)
-                || (".".equals(inputSegments[i]))) {
+        for (String inputSegment : inputSegments) {
+            if ((inputSegment.length() == 0)
+                || (".".equals(inputSegment))) {
                 // Do nothing
-            } else if ("..".equals(inputSegments[i])) {
+            } else if ("..".equals(inputSegment)) {
                 if (!outputSegments.isEmpty()) {
                     outputSegments.pop();
                 }
             } else {
-                outputSegments.push(inputSegments[i]);
+                outputSegments.push(inputSegment);
             }
         }
         StringBuilder outputBuffer = new StringBuilder();

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/routing/HttpRoute.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/routing/HttpRoute.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/routing/HttpRoute.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/routing/HttpRoute.java Thu Nov  8 13:46:24 2012
@@ -358,8 +358,8 @@ public final class HttpRoute implements 
         int hash = LangUtils.HASH_SEED;
         hash = LangUtils.hashCode(hash, this.targetHost);
         hash = LangUtils.hashCode(hash, this.localAddress);
-        for (int i = 0; i < this.proxyChain.length; i++) {
-            hash = LangUtils.hashCode(hash, this.proxyChain[i]);
+        for (HttpHost element : this.proxyChain) {
+            hash = LangUtils.hashCode(hash, element);
         }
         hash = LangUtils.hashCode(hash, this.secure);
         hash = LangUtils.hashCode(hash, this.tunnelled);

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/routing/RouteTracker.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/routing/RouteTracker.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/routing/RouteTracker.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/routing/RouteTracker.java Thu Nov  8 13:46:24 2012
@@ -329,8 +329,8 @@ public final class RouteTracker implemen
         hash = LangUtils.hashCode(hash, this.targetHost);
         hash = LangUtils.hashCode(hash, this.localAddress);
         if (this.proxyChain != null) {
-            for (int i = 0; i < this.proxyChain.length; i++) {
-                hash = LangUtils.hashCode(hash, this.proxyChain[i]);
+            for (HttpHost element : this.proxyChain) {
+                hash = LangUtils.hashCode(hash, element);
             }
         }
         hash = LangUtils.hashCode(hash, this.connected);
@@ -365,8 +365,8 @@ public final class RouteTracker implemen
             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 element : this.proxyChain) {
+                cab.append(element);
                 cab.append("->");
             }
         }

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/NTLMEngineImpl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/NTLMEngineImpl.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/NTLMEngineImpl.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/NTLMEngineImpl.java Thu Nov  8 13:46:24 2012
@@ -709,8 +709,8 @@ final class NTLMEngineImpl implements NT
          *            the bytes to add.
          */
         protected void addBytes(byte[] bytes) {
-            for (int i = 0; i < bytes.length; i++) {
-                messageContents[currentOutputPosition] = bytes[i];
+            for (byte b : bytes) {
+                messageContents[currentOutputPosition] = b;
                 currentOutputPosition++;
             }
         }

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965PortAttributeHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965PortAttributeHandler.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965PortAttributeHandler.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965PortAttributeHandler.java Thu Nov  8 13:46:24 2012
@@ -92,8 +92,8 @@ public class RFC2965PortAttributeHandler
      */
     private static boolean portMatch(int port, int[] ports) {
         boolean portInList = false;
-        for (int i = 0, len = ports.length; i < len; i++) {
-            if (port == ports[i]) {
+        for (int port2 : ports) {
+            if (port == port2) {
                 portInList = true;
                 break;
             }

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/utils/TestURLEncodedUtils.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/utils/TestURLEncodedUtils.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/utils/TestURLEncodedUtils.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/utils/TestURLEncodedUtils.java Thu Nov  8 13:46:24 2012
@@ -194,8 +194,8 @@ public class TestURLEncodedUtils {
     private static String constructString(int [] unicodeChars) {
         StringBuffer buffer = new StringBuffer();
         if (unicodeChars != null) {
-            for (int i = 0; i < unicodeChars.length; i++) {
-                buffer.append((char)unicodeChars[i]);
+            for (int unicodeChar : unicodeChars) {
+                buffer.append((char)unicodeChar);
             }
         }
         return buffer.toString();

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/auth/TestBasicScheme.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/auth/TestBasicScheme.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/auth/TestBasicScheme.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/auth/TestBasicScheme.java Thu Nov  8 13:46:24 2012
@@ -58,8 +58,8 @@ public class TestBasicScheme {
     public void testBasicAuthenticationWith88591Chars() throws Exception {
         int[] germanChars = { 0xE4, 0x2D, 0xF6, 0x2D, 0xFc };
         StringBuilder buffer = new StringBuilder();
-        for (int i = 0; i < germanChars.length; i++) {
-            buffer.append((char)germanChars[i]);
+        for (int germanChar : germanChars) {
+            buffer.append((char)germanChar);
         }
 
         UsernamePasswordCredentials credentials = new UsernamePasswordCredentials("dh", buffer.toString());

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/auth/TestDigestScheme.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/auth/TestDigestScheme.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/auth/TestDigestScheme.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/auth/TestDigestScheme.java Thu Nov  8 13:46:24 2012
@@ -421,8 +421,7 @@ public class TestDigestScheme {
         }
         HeaderElement[] elements = BasicHeaderValueParser.parseElements(s.substring(7), null);
         Map<String, String> map = new HashMap<String, String>(elements.length);
-        for (int i = 0; i < elements.length; i++) {
-            HeaderElement element = elements[i];
+        for (HeaderElement element : elements) {
             map.put(element.getName(), element.getValue());
         }
         return map;

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestConnectionReuse.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestConnectionReuse.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestConnectionReuse.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestConnectionReuse.java Thu Nov  8 13:46:24 2012
@@ -95,13 +95,11 @@ public class TestConnectionReuse {
                     10, false);
         }
 
-        for (int i = 0; i < workers.length; i++) {
-            WorkerThread worker = workers[i];
+        for (WorkerThread worker : workers) {
             worker.start();
         }
-        for (int i = 0; i < workers.length; i++) {
-            WorkerThread worker = workers[i];
-            workers[i].join(10000);
+        for (WorkerThread worker : workers) {
+            worker.join(10000);
             Exception ex = worker.getException();
             if (ex != null) {
                 throw ex;
@@ -155,13 +153,11 @@ public class TestConnectionReuse {
                     10, false);
         }
 
-        for (int i = 0; i < workers.length; i++) {
-            WorkerThread worker = workers[i];
+        for (WorkerThread worker : workers) {
             worker.start();
         }
-        for (int i = 0; i < workers.length; i++) {
-            WorkerThread worker = workers[i];
-            workers[i].join(10000);
+        for (WorkerThread worker : workers) {
+            worker.join(10000);
             Exception ex = worker.getException();
             if (ex != null) {
                 throw ex;
@@ -205,13 +201,11 @@ public class TestConnectionReuse {
                     10, true);
         }
 
-        for (int i = 0; i < workers.length; i++) {
-            WorkerThread worker = workers[i];
+        for (WorkerThread worker : workers) {
             worker.start();
         }
-        for (int i = 0; i < workers.length; i++) {
-            WorkerThread worker = workers[i];
-            workers[i].join(10000);
+        for (WorkerThread worker : workers) {
+            worker.join(10000);
             Exception ex = worker.getException();
             if (ex != null) {
                 throw ex;

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestIdleConnectionEviction.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestIdleConnectionEviction.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestIdleConnectionEviction.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestIdleConnectionEviction.java Thu Nov  8 13:46:24 2012
@@ -72,12 +72,12 @@ public class TestIdleConnectionEviction 
         for (int i = 0; i < workers.length; i++) {
             workers[i] = new WorkerThread(httpclient, target, httpget, 200);
         }
-        for (int i = 0; i < workers.length; i++) {
-            workers[i].start();
+        for (WorkerThread worker : workers) {
+            worker.start();
         }
-        for (int i = 0; i < workers.length; i++) {
-            workers[i].join();
-            Exception ex = workers[i].getException();
+        for (WorkerThread worker : workers) {
+            worker.join();
+            Exception ex = worker.getException();
             if (ex != null) {
                 throw ex;
             }

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestStatefulConnManagement.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestStatefulConnManagement.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestStatefulConnManagement.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestStatefulConnManagement.java Thu Nov  8 13:46:24 2012
@@ -119,22 +119,21 @@ public class TestStatefulConnManagement 
                     context, requestCount, target, this.httpclient);
         }
 
-        for (int i = 0; i < workers.length; i++) {
-            workers[i].start();
+        for (HttpWorker worker : workers) {
+            worker.start();
         }
-        for (int i = 0; i < workers.length; i++) {
-            workers[i].join(10000);
+        for (HttpWorker worker : workers) {
+            worker.join(10000);
         }
-        for (int i = 0; i < workers.length; i++) {
-            Exception ex = workers[i].getException();
+        for (HttpWorker worker : workers) {
+            Exception ex = worker.getException();
             if (ex != null) {
                 throw ex;
             }
-            Assert.assertEquals(requestCount, workers[i].getCount());
+            Assert.assertEquals(requestCount, worker.getCount());
         }
 
-        for (int i = 0; i < contexts.length; i++) {
-            HttpContext context = contexts[i];
+        for (HttpContext context : contexts) {
             String uid = (String) context.getAttribute("user");
 
             for (int r = 0; r < requestCount; r++) {

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/conn/ConnPoolBench.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/conn/ConnPoolBench.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/conn/ConnPoolBench.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/conn/ConnPoolBench.java Thu Nov  8 13:46:24 2012
@@ -65,11 +65,11 @@ public class ConnPoolBench {
             workers[i] = new WorkerThread1(pool, reps);
         }
         long start = System.currentTimeMillis();
-        for (int i = 0; i < workers.length; i++) {
-            workers[i].start();
+        for (WorkerThread1 worker : workers) {
+            worker.start();
         }
-        for (int i = 0; i < workers.length; i++) {
-            workers[i].join();
+        for (WorkerThread1 worker : workers) {
+            worker.join();
         }
         long finish = System.currentTimeMillis();
         float totalTimeSec = (float) (finish - start) / 1000;
@@ -93,11 +93,11 @@ public class ConnPoolBench {
             workers[i] = new WorkerThread2(pool, reps);
         }
         long start = System.currentTimeMillis();
-        for (int i = 0; i < workers.length; i++) {
-            workers[i].start();
+        for (WorkerThread2 worker : workers) {
+            worker.start();
         }
-        for (int i = 0; i < workers.length; i++) {
-            workers[i].join();
+        for (WorkerThread2 worker : workers) {
+            worker.join();
         }
         long finish = System.currentTimeMillis();
         float totalTimeSec = (float) (finish - start) / 1000;

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/localserver/LocalTestServer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/localserver/LocalTestServer.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/localserver/LocalTestServer.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/localserver/LocalTestServer.java Thu Nov  8 13:46:24 2012
@@ -33,7 +33,6 @@ import java.net.ServerSocket;
 import java.net.Socket;
 import java.util.Collections;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicInteger;
 
@@ -281,8 +280,7 @@ public class LocalTestServer {
             t.shutdown();
         }
         synchronized (workers) {
-            for (Iterator<Worker> it = workers.iterator(); it.hasNext(); ) {
-                Worker worker = it.next();
+            for (Worker worker : workers) {
                 worker.shutdown();
             }
         }

Modified: httpcomponents/httpclient/trunk/httpmime/src/test/java/org/apache/http/entity/mime/TestMultipartForm.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpmime/src/test/java/org/apache/http/entity/mime/TestMultipartForm.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpmime/src/test/java/org/apache/http/entity/mime/TestMultipartForm.java (original)
+++ httpcomponents/httpclient/trunk/httpmime/src/test/java/org/apache/http/entity/mime/TestMultipartForm.java Thu Nov  8 13:46:24 2012
@@ -215,8 +215,8 @@ public class TestMultipartForm {
     private static String constructString(int [] unicodeChars) {
         StringBuilder buffer = new StringBuilder();
         if (unicodeChars != null) {
-            for (int i = 0; i < unicodeChars.length; i++) {
-                buffer.append((char)unicodeChars[i]);
+            for (int unicodeChar : unicodeChars) {
+                buffer.append((char)unicodeChar);
             }
         }
         return buffer.toString();

Modified: httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/BenchmarkWorker.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/BenchmarkWorker.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/BenchmarkWorker.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/BenchmarkWorker.java Thu Nov  8 13:46:24 2012
@@ -230,8 +230,8 @@ class BenchmarkWorker implements Runnabl
         if (config.getVerbosity() >= 3) {
             System.out.println(">> " + request.getRequestLine().toString());
             Header[] headers = request.getAllHeaders();
-            for (int h = 0; h < headers.length; h++) {
-                System.out.println(">> " + headers[h].toString());
+            for (Header header : headers) {
+                System.out.println(">> " + header.toString());
             }
             System.out.println();
         }
@@ -241,8 +241,8 @@ class BenchmarkWorker implements Runnabl
         if (config.getVerbosity() >= 3) {
             System.out.println("<< " + response.getStatusLine().toString());
             Header[] headers = response.getAllHeaders();
-            for (int h = 0; h < headers.length; h++) {
-                System.out.println("<< " + headers[h].toString());
+            for (Header header : headers) {
+                System.out.println("<< " + header.toString());
             }
             System.out.println();
         }

Modified: httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/HttpBenchmark.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/HttpBenchmark.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/HttpBenchmark.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/HttpBenchmark.java Thu Nov  8 13:46:24 2012
@@ -141,8 +141,7 @@ public class HttpBenchmark {
 
         String[] headers = config.getHeaders();
         if (headers != null) {
-            for (int i = 0; i < headers.length; i++) {
-                String s = headers[i];
+            for (String s : headers) {
                 int pos = s.indexOf(':');
                 if (pos != -1) {
                     Header header = new DefaultHeader(s.substring(0, pos).trim(), s.substring(pos + 1));

Modified: httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/ResultProcessor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/ResultProcessor.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/ResultProcessor.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/ResultProcessor.java Thu Nov  8 13:46:24 2012
@@ -56,8 +56,8 @@ public class ResultProcessor {
 
         Stats stats = workers[0].getStats();
 
-        for (int i = 0; i < workers.length; i++) {
-            Stats s = workers[i].getStats();
+        for (BenchmarkWorker worker : workers) {
+            Stats s = worker.getStats();
             totalTimeNano  += s.getDuration();
             successCount   += s.getSuccessCount();
             failureCount   += s.getFailureCount();

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java Thu Nov  8 13:46:24 2012
@@ -37,7 +37,6 @@ import java.nio.channels.Selector;
 import java.nio.channels.SocketChannel;
 import java.util.Collections;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.Queue;
 import java.util.Set;
 import java.util.concurrent.ConcurrentLinkedQueue;
@@ -311,9 +310,8 @@ public abstract class AbstractIOReactor 
     }
 
     private void processEvents(final Set<SelectionKey> selectedKeys) {
-        for (Iterator<SelectionKey> it = selectedKeys.iterator(); it.hasNext(); ) {
+        for (SelectionKey key : selectedKeys) {
 
-            SelectionKey key = it.next();
             processEvent(key);
 
         }
@@ -499,8 +497,7 @@ public abstract class AbstractIOReactor 
      */
     protected void closeSessions() {
         synchronized (this.sessions) {
-            for (Iterator<IOSession> it = this.sessions.iterator(); it.hasNext(); ) {
-                IOSession session = it.next();
+            for (IOSession session : this.sessions) {
                 session.close();
             }
         }
@@ -534,8 +531,7 @@ public abstract class AbstractIOReactor 
     protected void closeActiveChannels() throws IOReactorException {
         try {
             Set<SelectionKey> keys = this.selector.keys();
-            for (Iterator<SelectionKey> it = keys.iterator(); it.hasNext(); ) {
-                SelectionKey key = it.next();
+            for (SelectionKey key : keys) {
                 IOSession session = getSession(key);
                 if (session != null) {
                     session.close();

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java Thu Nov  8 13:46:24 2012
@@ -38,7 +38,6 @@ import java.nio.channels.SelectionKey;
 import java.nio.channels.Selector;
 import java.util.ArrayList;
 import java.util.Date;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 import java.util.concurrent.ThreadFactory;
@@ -413,9 +412,9 @@ public abstract class AbstractMultiworke
         // Close out all channels
         if (this.selector.isOpen()) {
             Set<SelectionKey> keys = this.selector.keys();
-            for (Iterator<SelectionKey> it = keys.iterator(); it.hasNext(); ) {
+            for (SelectionKey key : keys) {
                 try {
-                    SelectionKey key = it.next();
+                    SelectionKey key = key;
                     Channel channel = key.channel();
                     if (channel != null) {
                         channel.close();

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/BaseIOReactor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/BaseIOReactor.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/BaseIOReactor.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/BaseIOReactor.java Thu Nov  8 13:46:24 2012
@@ -201,8 +201,7 @@ public class BaseIOReactor extends Abstr
         if( (currentTime - this.lastTimeoutCheck) >= this.timeoutCheckInterval) {
             this.lastTimeoutCheck = currentTime;
             if (keys != null) {
-                for (Iterator<SelectionKey> it = keys.iterator(); it.hasNext();) {
-                    SelectionKey key = it.next();
+                for (SelectionKey key : keys) {
                     timeoutCheck(key, currentTime);
                 }
             }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultConnectingIOReactor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultConnectingIOReactor.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultConnectingIOReactor.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultConnectingIOReactor.java Thu Nov  8 13:46:24 2012
@@ -35,7 +35,6 @@ import java.net.UnknownHostException;
 import java.nio.channels.CancelledKeyException;
 import java.nio.channels.SelectionKey;
 import java.nio.channels.SocketChannel;
-import java.util.Iterator;
 import java.util.Queue;
 import java.util.Set;
 import java.util.concurrent.ConcurrentLinkedQueue;
@@ -142,9 +141,8 @@ public class DefaultConnectingIOReactor 
 
         if (readyCount > 0) {
             Set<SelectionKey> selectedKeys = this.selector.selectedKeys();
-            for (Iterator<SelectionKey> it = selectedKeys.iterator(); it.hasNext(); ) {
+            for (SelectionKey key : selectedKeys) {
 
-                SelectionKey key = it.next();
                 processEvent(key);
 
             }
@@ -202,8 +200,7 @@ public class DefaultConnectingIOReactor 
 
     private void processTimeouts(final Set<SelectionKey> keys) {
         long now = System.currentTimeMillis();
-        for (Iterator<SelectionKey> it = keys.iterator(); it.hasNext();) {
-            SelectionKey key = it.next();
+        for (SelectionKey key : keys) {
             Object attachment = key.attachment();
 
             if (attachment instanceof SessionRequestHandle) {

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultListeningIOReactor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultListeningIOReactor.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultListeningIOReactor.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultListeningIOReactor.java Thu Nov  8 13:46:24 2012
@@ -146,9 +146,8 @@ public class DefaultListeningIOReactor e
 
         if (readyCount > 0) {
             Set<SelectionKey> selectedKeys = this.selector.selectedKeys();
-            for (Iterator<SelectionKey> it = selectedKeys.iterator(); it.hasNext(); ) {
+            for (SelectionKey key : selectedKeys) {
 
-                SelectionKey key = it.next();
                 processEvent(key);
 
             }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestSessionInOutBuffers.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestSessionInOutBuffers.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestSessionInOutBuffers.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestSessionInOutBuffers.java Thu Nov  8 13:46:24 2012
@@ -202,8 +202,8 @@ public class TestSessionInOutBuffers {
         teststrs[4] = "And goodbye";
 
         SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 16, null, this.allocator);
-        for (int i = 0; i < teststrs.length; i++) {
-            outbuf.writeLine(teststrs[i]);
+        for (String teststr : teststrs) {
+            outbuf.writeLine(teststr);
         }
         //this write operation should have no effect
         outbuf.writeLine((String)null);
@@ -218,8 +218,8 @@ public class TestSessionInOutBuffers {
         SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 16, null, this.allocator);
         inbuf.fill(channel);
 
-        for (int i = 0; i < teststrs.length; i++) {
-            Assert.assertEquals(teststrs[i], inbuf.readLine(true));
+        for (String teststr : teststrs) {
+            Assert.assertEquals(teststr, inbuf.readLine(true));
         }
         Assert.assertNull(inbuf.readLine(true));
         Assert.assertNull(inbuf.readLine(true));
@@ -413,8 +413,8 @@ public class TestSessionInOutBuffers {
     private static String constructString(int [] unicodeChars) {
         StringBuilder buffer = new StringBuilder();
         if (unicodeChars != null) {
-            for (int i = 0; i < unicodeChars.length; i++) {
-                buffer.append((char)unicodeChars[i]);
+            for (int unicodeChar : unicodeChars) {
+                buffer.append((char)unicodeChar);
             }
         }
         return buffer.toString();

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestAsyncNHttpHandlers.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestAsyncNHttpHandlers.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestAsyncNHttpHandlers.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestAsyncNHttpHandlers.java Thu Nov  8 13:46:24 2012
@@ -131,8 +131,8 @@ public class TestAsyncNHttpHandlers exte
             jobs[i] = new Job();
         }
         Queue<Job> queue = new ConcurrentLinkedQueue<Job>();
-        for (int i = 0; i < jobs.length; i++) {
-            queue.add(jobs[i]);
+        for (Job job : jobs) {
+            queue.add(job);
         }
 
         AsyncNHttpServiceHandler serviceHandler = new AsyncNHttpServiceHandler(
@@ -183,8 +183,7 @@ public class TestAsyncNHttpHandlers exte
 
         Assert.assertEquals("Test client status", IOReactorStatus.ACTIVE, this.client.getStatus());
 
-        for (int i = 0; i < jobs.length; i++) {
-            Job testjob = jobs[i];
+        for (Job testjob : jobs) {
             testjob.waitFor();
             if (testjob.isSuccessful()) {
                 Assert.assertEquals(HttpStatus.SC_OK, testjob.getStatusCode());
@@ -333,8 +332,8 @@ public class TestAsyncNHttpHandlers exte
         jobs[1] = new Job("AAAAA", 10);
         jobs[2] = new Job("BBBBB", 20);
         Queue<Job> queue = new ConcurrentLinkedQueue<Job>();
-        for (int i = 0; i < jobs.length; i++) {
-            queue.add(jobs[i]);
+        for (Job job : jobs) {
+            queue.add(job);
         }
 
         HttpExpectationVerifier expectationVerifier = new HttpExpectationVerifier() {
@@ -455,8 +454,8 @@ public class TestAsyncNHttpHandlers exte
             jobs[i] = new Job();
         }
         Queue<Job> queue = new ConcurrentLinkedQueue<Job>();
-        for (int i = 0; i < jobs.length; i++) {
-            queue.add(jobs[i]);
+        for (Job job : jobs) {
+            queue.add(job);
         }
 
         NHttpRequestExecutionHandler requestExecutionHandler = new RequestExecutionHandler() {
@@ -530,8 +529,7 @@ public class TestAsyncNHttpHandlers exte
 
         Assert.assertEquals("Test client status", IOReactorStatus.ACTIVE, this.client.getStatus());
 
-        for (int i = 0; i < jobs.length; i++) {
-            Job testjob = jobs[i];
+        for (Job testjob : jobs) {
             testjob.waitFor();
             if (testjob.getFailureMessage() != null) {
                 Assert.fail(testjob.getFailureMessage());
@@ -646,8 +644,8 @@ public class TestAsyncNHttpHandlers exte
             jobs[i] = new Job();
         }
         Queue<Job> queue = new ConcurrentLinkedQueue<Job>();
-        for (int i = 0; i < jobs.length; i++) {
-            queue.add(jobs[i]);
+        for (Job job : jobs) {
+            queue.add(job);
         }
 
         HttpProcessor serverHttpProc = new ImmutableHttpProcessor(new HttpResponseInterceptor[] {
@@ -711,8 +709,7 @@ public class TestAsyncNHttpHandlers exte
 
         Assert.assertEquals("Test client status", IOReactorStatus.ACTIVE, this.client.getStatus());
 
-        for (int i = 0; i < jobs.length; i++) {
-            Job testjob = jobs[i];
+        for (Job testjob : jobs) {
             testjob.waitFor();
             if (testjob.isSuccessful()) {
                 Assert.assertEquals(HttpStatus.SC_INTERNAL_SERVER_ERROR, testjob.getStatusCode());
@@ -768,8 +765,8 @@ public class TestAsyncNHttpHandlers exte
             jobs[i] = new Job();
         }
         Queue<Job> queue = new ConcurrentLinkedQueue<Job>();
-        for (int i = 0; i < jobs.length; i++) {
-            queue.add(jobs[i]);
+        for (Job job : jobs) {
+            queue.add(job);
         }
 
         HttpProcessor serverHttpProc = new ImmutableHttpProcessor(new HttpResponseInterceptor[] {
@@ -833,8 +830,7 @@ public class TestAsyncNHttpHandlers exte
 
         Assert.assertEquals("Test client status", IOReactorStatus.ACTIVE, this.client.getStatus());
 
-        for (int i = 0; i < jobs.length; i++) {
-            Job testjob = jobs[i];
+        for (Job testjob : jobs) {
             testjob.waitFor();
             if (testjob.isSuccessful()) {
                 Assert.assertEquals(HttpStatus.SC_INTERNAL_SERVER_ERROR, testjob.getStatusCode());
@@ -866,8 +862,8 @@ public class TestAsyncNHttpHandlers exte
             jobs[i] = new Job();
         }
         Queue<Job> queue = new ConcurrentLinkedQueue<Job>();
-        for (int i = 0; i < jobs.length; i++) {
-            queue.add(jobs[i]);
+        for (Job job : jobs) {
+            queue.add(job);
         }
 
         HttpProcessor serverHttpProc = new ImmutableHttpProcessor(new HttpResponseInterceptor[] {
@@ -929,9 +925,7 @@ public class TestAsyncNHttpHandlers exte
 
         Assert.assertEquals("Test client status", IOReactorStatus.ACTIVE, this.client.getStatus());
 
-        for (int i = 0; i < jobs.length; i++) {
-            Job testjob = jobs[i];
-
+        for (Job testjob : jobs) {
             testjob.waitFor();
             if (testjob.isSuccessful()) {
                 Assert.assertEquals(HttpStatus.SC_NOT_IMPLEMENTED, testjob.getStatusCode());
@@ -968,8 +962,8 @@ public class TestAsyncNHttpHandlers exte
             jobs[i] = new Job();
         }
         Queue<Job> queue = new ConcurrentLinkedQueue<Job>();
-        for (int i = 0; i < jobs.length; i++) {
-            queue.add(jobs[i]);
+        for (Job job : jobs) {
+            queue.add(job);
         }
 
         HttpProcessor serverHttpProc = new ImmutableHttpProcessor(new HttpResponseInterceptor[] {
@@ -1033,8 +1027,7 @@ public class TestAsyncNHttpHandlers exte
 
         Assert.assertEquals("Test client status", IOReactorStatus.ACTIVE, this.client.getStatus());
 
-        for (int i = 0; i < jobs.length; i++) {
-            Job testjob = jobs[i];
+        for (Job testjob : jobs) {
             testjob.waitFor();
             if (testjob.isSuccessful()) {
                 Assert.assertEquals(HttpStatus.SC_OK, testjob.getStatusCode());
@@ -1067,8 +1060,8 @@ public class TestAsyncNHttpHandlers exte
             jobs[i] = new Job();
         }
         Queue<Job> queue = new ConcurrentLinkedQueue<Job>();
-        for (int i = 0; i < jobs.length; i++) {
-            queue.add(jobs[i]);
+        for (Job job : jobs) {
+            queue.add(job);
         }
 
         HttpProcessor serverHttpProc = new ImmutableHttpProcessor(new HttpResponseInterceptor[] {
@@ -1132,8 +1125,7 @@ public class TestAsyncNHttpHandlers exte
 
         Assert.assertEquals("Test client status", IOReactorStatus.ACTIVE, this.client.getStatus());
 
-        for (int i = 0; i < jobs.length; i++) {
-            Job testjob = jobs[i];
+        for (Job testjob : jobs) {
             testjob.waitFor();
             if (testjob.isSuccessful()) {
                 Assert.assertEquals(HttpStatus.SC_NOT_IMPLEMENTED, testjob.getStatusCode());

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlers.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlers.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlers.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlers.java Thu Nov  8 13:46:24 2012
@@ -484,11 +484,11 @@ public class TestHttpAsyncHandlers exten
         HttpHost target = new HttpHost("localhost", address.getPort());
 
         Queue<Future<HttpResponse>> queue = new ConcurrentLinkedQueue<Future<HttpResponse>>();
-        for (int i = 0; i < requests.length; i++) {
+        for (HttpRequest request : requests) {
             HttpContext context = new BasicHttpContext();
             context.setAttribute(ExecutionContext.HTTP_EXPECT_CONT, Boolean.TRUE);
 
-            Future<HttpResponse> future = this.client.execute(target, requests[i], context);
+            Future<HttpResponse> future = this.client.execute(target, request, context);
             queue.add(future);
         }
 
@@ -629,11 +629,11 @@ public class TestHttpAsyncHandlers exten
         HttpHost target = new HttpHost("localhost", address.getPort());
 
         Queue<Future<HttpResponse>> queue = new ConcurrentLinkedQueue<Future<HttpResponse>>();
-        for (int i = 0; i < requests.length; i++) {
+        for (HttpRequest request : requests) {
             HttpContext context = new BasicHttpContext();
             context.setAttribute(ExecutionContext.HTTP_EXPECT_CONT, Boolean.TRUE);
 
-            Future<HttpResponse> future = this.client.execute(target, requests[i], context);
+            Future<HttpResponse> future = this.client.execute(target, request, context);
             queue.add(future);
         }
 

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestThrottlingNHttpHandlers.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestThrottlingNHttpHandlers.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestThrottlingNHttpHandlers.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestThrottlingNHttpHandlers.java Thu Nov  8 13:46:24 2012
@@ -150,8 +150,8 @@ public class TestThrottlingNHttpHandlers
             jobs[i] = new Job();
         }
         Queue<Job> queue = new ConcurrentLinkedQueue<Job>();
-        for (int i = 0; i < jobs.length; i++) {
-            queue.add(jobs[i]);
+        for (Job job : jobs) {
+            queue.add(job);
         }
 
         ThrottlingHttpServiceHandler serviceHandler = new ThrottlingHttpServiceHandler(
@@ -204,8 +204,7 @@ public class TestThrottlingNHttpHandlers
 
         Assert.assertEquals("Test client status", IOReactorStatus.ACTIVE, this.client.getStatus());
 
-        for (int i = 0; i < jobs.length; i++) {
-            Job testjob = jobs[i];
+        for (Job testjob : jobs) {
             testjob.waitFor();
             if (testjob.isSuccessful()) {
                 Assert.assertEquals(HttpStatus.SC_OK, testjob.getStatusCode());
@@ -349,8 +348,8 @@ public class TestThrottlingNHttpHandlers
         jobs[1] = new Job("AAAAA", 10);
         jobs[2] = new Job("BBBBB", 20);
         Queue<Job> queue = new ConcurrentLinkedQueue<Job>();
-        for (int i = 0; i < jobs.length; i++) {
-            queue.add(jobs[i]);
+        for (Job job : jobs) {
+            queue.add(job);
         }
 
         HttpExpectationVerifier expectationVerifier = new HttpExpectationVerifier() {
@@ -474,8 +473,8 @@ public class TestThrottlingNHttpHandlers
             jobs[i] = new Job();
         }
         Queue<Job> queue = new ConcurrentLinkedQueue<Job>();
-        for (int i = 0; i < jobs.length; i++) {
-            queue.add(jobs[i]);
+        for (Job job : jobs) {
+            queue.add(job);
         }
 
         HttpRequestExecutionHandler requestExecutionHandler = new RequestExecutionHandler() {
@@ -551,8 +550,7 @@ public class TestThrottlingNHttpHandlers
 
         Assert.assertEquals("Test client status", IOReactorStatus.ACTIVE, this.client.getStatus());
 
-        for (int i = 0; i < jobs.length; i++) {
-            Job testjob = jobs[i];
+        for (Job testjob : jobs) {
             testjob.waitFor();
             if (testjob.getFailureMessage() != null) {
                 Assert.fail(testjob.getFailureMessage());
@@ -606,8 +604,8 @@ public class TestThrottlingNHttpHandlers
             jobs[i] = new Job();
         }
         Queue<Job> queue = new ConcurrentLinkedQueue<Job>();
-        for (int i = 0; i < jobs.length; i++) {
-            queue.add(jobs[i]);
+        for (Job job : jobs) {
+            queue.add(job);
         }
 
         HttpProcessor serverHttpProc = new ImmutableHttpProcessor(new HttpResponseInterceptor[] {
@@ -674,8 +672,7 @@ public class TestThrottlingNHttpHandlers
 
         Assert.assertEquals("Test client status", IOReactorStatus.ACTIVE, this.client.getStatus());
 
-        for (int i = 0; i < jobs.length; i++) {
-            Job testjob = jobs[i];
+        for (Job testjob : jobs) {
             testjob.waitFor();
             if (testjob.isSuccessful()) {
                 Assert.assertEquals(HttpStatus.SC_INTERNAL_SERVER_ERROR, testjob.getStatusCode());
@@ -774,8 +771,8 @@ public class TestThrottlingNHttpHandlers
             jobs[i] = new Job(10000);
         }
         Queue<Job> queue = new ConcurrentLinkedQueue<Job>();
-        for (int i = 0; i < jobs.length; i++) {
-            queue.add(jobs[i]);
+        for (Job job : jobs) {
+            queue.add(job);
         }
 
         HttpProcessor serverHttpProc = new ImmutableHttpProcessor(new HttpResponseInterceptor[] {
@@ -842,8 +839,7 @@ public class TestThrottlingNHttpHandlers
 
         Assert.assertEquals("Test client status", IOReactorStatus.ACTIVE, this.client.getStatus());
 
-        for (int i = 0; i < jobs.length; i++) {
-            Job testjob = jobs[i];
+        for (Job testjob : jobs) {
             testjob.waitFor();
             if (testjob.isSuccessful()) {
                 Assert.assertEquals(HttpStatus.SC_OK, testjob.getStatusCode());

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/LoggingNHttpClientConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/LoggingNHttpClientConnection.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/LoggingNHttpClientConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/LoggingNHttpClientConnection.java Thu Nov  8 13:46:24 2012
@@ -107,8 +107,8 @@ public class LoggingNHttpClientConnectio
         if (response != null && this.headerlog.isDebugEnabled()) {
             this.headerlog.debug(this.id + " << " + response.getStatusLine().toString());
             Header[] headers = response.getAllHeaders();
-            for (int i = 0; i < headers.length; i++) {
-                this.headerlog.debug(this.id + " << " + headers[i].toString());
+            for (Header header : headers) {
+                this.headerlog.debug(this.id + " << " + header.toString());
             }
         }
     }
@@ -118,8 +118,8 @@ public class LoggingNHttpClientConnectio
         if (request != null && this.headerlog.isDebugEnabled()) {
             this.headerlog.debug(id + " >> " + request.getRequestLine().toString());
             Header[] headers = request.getAllHeaders();
-            for (int i = 0; i < headers.length; i++) {
-                this.headerlog.debug(this.id + " >> " + headers[i].toString());
+            for (Header header : headers) {
+                this.headerlog.debug(this.id + " >> " + header.toString());
             }
         }
     }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/LoggingNHttpServerConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/LoggingNHttpServerConnection.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/LoggingNHttpServerConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/LoggingNHttpServerConnection.java Thu Nov  8 13:46:24 2012
@@ -107,8 +107,8 @@ public class LoggingNHttpServerConnectio
         if (request != null && this.headerlog.isDebugEnabled()) {
             this.headerlog.debug(this.id + " >> " + request.getRequestLine().toString());
             Header[] headers = request.getAllHeaders();
-            for (int i = 0; i < headers.length; i++) {
-                this.headerlog.debug(this.id + " >> " + headers[i].toString());
+            for (Header header : headers) {
+                this.headerlog.debug(this.id + " >> " + header.toString());
             }
         }
     }
@@ -118,8 +118,8 @@ public class LoggingNHttpServerConnectio
         if (response != null && this.headerlog.isDebugEnabled()) {
             this.headerlog.debug(this.id + " << " + response.getStatusLine().toString());
             Header[] headers = response.getAllHeaders();
-            for (int i = 0; i < headers.length; i++) {
-                this.headerlog.debug(this.id + " << " + headers[i].toString());
+            for (Header header : headers) {
+                this.headerlog.debug(this.id + " << " + header.toString());
             }
         }
     }

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/DefaultHttpRequestFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/DefaultHttpRequestFactory.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/DefaultHttpRequestFactory.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/DefaultHttpRequestFactory.java Thu Nov  8 13:46:24 2012
@@ -69,8 +69,8 @@ public class DefaultHttpRequestFactory i
     }
 
     private static boolean isOneOf(final String[] methods, final String method) {
-        for (int i = 0; i < methods.length; i++) {
-            if (methods[i].equalsIgnoreCase(method)) {
+        for (String method2 : methods) {
+            if (method2.equalsIgnoreCase(method)) {
                 return true;
             }
         }

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderElement.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderElement.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderElement.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderElement.java Thu Nov  8 13:46:24 2012
@@ -101,8 +101,7 @@ public class BasicHeaderElement implemen
     public NameValuePair getParameterByName(final String name) {
         Args.notNull(name, "Name");
         NameValuePair found = null;
-        for (int i = 0; i < this.parameters.length; i++) {
-            NameValuePair current = this.parameters[ i ];
+        for (NameValuePair current : this.parameters) {
             if (current.getName().equalsIgnoreCase(name)) {
                 found = current;
                 break;
@@ -129,8 +128,8 @@ public class BasicHeaderElement implemen
         int hash = LangUtils.HASH_SEED;
         hash = LangUtils.hashCode(hash, this.name);
         hash = LangUtils.hashCode(hash, this.value);
-        for (int i = 0; i < this.parameters.length; i++) {
-            hash = LangUtils.hashCode(hash, this.parameters[i]);
+        for (NameValuePair parameter : this.parameters) {
+            hash = LangUtils.hashCode(hash, parameter);
         }
         return hash;
     }
@@ -143,9 +142,9 @@ public class BasicHeaderElement implemen
             buffer.append("=");
             buffer.append(this.value);
         }
-        for (int i = 0; i < this.parameters.length; i++) {
+        for (NameValuePair parameter : this.parameters) {
             buffer.append("; ");
-            buffer.append(this.parameters[i]);
+            buffer.append(parameter);
         }
         return buffer.toString();
     }

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderValueFormatter.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderValueFormatter.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderValueFormatter.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderValueFormatter.java Thu Nov  8 13:46:24 2012
@@ -130,8 +130,8 @@ public class BasicHeaderValueFormatter i
             return 0;
 
         int result = (elems.length-1) * 2; // elements separated by ", "
-        for (int i=0; i<elems.length; i++) {
-            result += estimateHeaderElementLen(elems[i]);
+        for (HeaderElement elem : elems) {
+            result += estimateHeaderElementLen(elem);
         }
 
         return result;
@@ -279,8 +279,8 @@ public class BasicHeaderValueFormatter i
             return 0;
 
         int result = (nvps.length-1) * 2; // "; " between the parameters
-        for (int i=0; i<nvps.length; i++) {
-            result += estimateNameValuePairLen(nvps[i]);
+        for (NameValuePair nvp : nvps) {
+            result += estimateNameValuePairLen(nvp);
         }
 
         return result;

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderValueParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderValueParser.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderValueParser.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderValueParser.java Thu Nov  8 13:46:24 2012
@@ -251,8 +251,8 @@ public class BasicHeaderValueParser impl
 
     private static boolean isOneOf(final char ch, final char[] chs) {
         if (chs != null) {
-            for (int i = 0; i < chs.length; i++) {
-                if (ch == chs[i]) {
+            for (char ch2 : chs) {
+                if (ch == ch2) {
                     return true;
                 }
             }

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/HeaderGroup.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/HeaderGroup.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/HeaderGroup.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/HeaderGroup.java Thu Nov  8 13:46:24 2012
@@ -125,8 +125,8 @@ public class HeaderGroup implements Clon
         if (headers == null) {
             return;
         }
-        for (int i = 0; i < headers.length; i++) {
-            this.headers.add(headers[i]);
+        for (Header header : headers) {
+            this.headers.add(header);
         }
     }
 

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/BasicHttpParams.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/BasicHttpParams.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/BasicHttpParams.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/BasicHttpParams.java Thu Nov  8 13:46:24 2012
@@ -92,8 +92,8 @@ public class BasicHttpParams extends Abs
      * @param value parameter value
      */
     public void setParameters(final String[] names, final Object value) {
-        for (int i = 0; i < names.length; i++) {
-            setParameter(names[i], value);
+        for (String name : names) {
+            setParameter(name, value);
         }
     }
 

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/ImmutableHttpProcessor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/ImmutableHttpProcessor.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/ImmutableHttpProcessor.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/ImmutableHttpProcessor.java Thu Nov  8 13:46:24 2012
@@ -127,16 +127,16 @@ public final class ImmutableHttpProcesso
     public void process(
             final HttpRequest request,
             final HttpContext context) throws IOException, HttpException {
-        for (int i = 0; i < this.requestInterceptors.length; i++) {
-            this.requestInterceptors[i].process(request, context);
+        for (HttpRequestInterceptor requestInterceptor : this.requestInterceptors) {
+            requestInterceptor.process(request, context);
         }
     }
 
     public void process(
             final HttpResponse response,
             final HttpContext context) throws IOException, HttpException {
-        for (int i = 0; i < this.responseInterceptors.length; i++) {
-            this.responseInterceptors[i].process(response, context);
+        for (HttpResponseInterceptor responseInterceptor : this.responseInterceptors) {
+            responseInterceptor.process(response, context);
         }
     }
 

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/UriPatternMatcher.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/UriPatternMatcher.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/UriPatternMatcher.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/UriPatternMatcher.java Thu Nov  8 13:46:24 2012
@@ -28,7 +28,6 @@
 package org.apache.http.protocol;
 
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 
 import org.apache.http.annotation.GuardedBy;
@@ -125,8 +124,7 @@ public class UriPatternMatcher<T> {
         if (obj == null) {
             // pattern match?
             String bestMatch = null;
-            for (Iterator<String> it = this.map.keySet().iterator(); it.hasNext();) {
-                String pattern = it.next();
+            for (String pattern : this.map.keySet()) {
                 if (matchUriRequestPattern(pattern, path)) {
                     // we have a match. is it any better?
                     if (bestMatch == null

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/VersionInfo.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/VersionInfo.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/VersionInfo.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/VersionInfo.java Thu Nov  8 13:46:24 2012
@@ -195,8 +195,8 @@ public class VersionInfo {
                                                       ClassLoader clsldr) {
         Args.notNull(pckgs, "Package identifier array");
         List<VersionInfo> vil = new ArrayList<VersionInfo>(pckgs.length);
-        for (int i=0; i<pckgs.length; i++) {
-            VersionInfo vi = loadVersionInfo(pckgs[i], clsldr);
+        for (String pckg : pckgs) {
+            VersionInfo vi = loadVersionInfo(pckg, clsldr);
             if (vi != null)
                 vil.add(vi);
         }

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestStringEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestStringEntity.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestStringEntity.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestStringEntity.java Thu Nov  8 13:46:24 2012
@@ -82,8 +82,8 @@ public class TestStringEntity {
     private static String constructString(int [] unicodeChars) {
         StringBuilder buffer = new StringBuilder();
         if (unicodeChars != null) {
-            for (int i = 0; i < unicodeChars.length; i++) {
-                buffer.append((char)unicodeChars[i]);
+            for (int unicodeChar : unicodeChars) {
+                buffer.append((char)unicodeChar);
             }
         }
         return buffer.toString();

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/TestEnglishReasonPhraseCatalog.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/TestEnglishReasonPhraseCatalog.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/TestEnglishReasonPhraseCatalog.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/TestEnglishReasonPhraseCatalog.java Thu Nov  8 13:46:24 2012
@@ -49,10 +49,7 @@ public class TestEnglishReasonPhraseCata
 
     Assert.assertTrue( publicFields.length > 0 );
 
-    for (int i = 0; i < publicFields.length; i++)
-    {
-        final Field f = publicFields[i];
-
+    for (final Field f : publicFields) {
         final int modifiers = f.getModifiers();
 
         if ( (f.getType() == int.class)

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestSessionInOutBuffers.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestSessionInOutBuffers.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestSessionInOutBuffers.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestSessionInOutBuffers.java Thu Nov  8 13:46:24 2012
@@ -81,9 +81,9 @@ public class TestSessionInOutBuffers {
 
         CharArrayBuffer chbuffer = new CharArrayBuffer(16);
         SessionOutputBufferMock outbuffer = new SessionOutputBufferMock();
-        for (int i = 0; i < teststrs.length; i++) {
+        for (String teststr : teststrs) {
             chbuffer.clear();
-            chbuffer.append(teststrs[i]);
+            chbuffer.append(teststr);
             outbuffer.writeLine(chbuffer);
         }
         //these write operations should have no effect
@@ -94,16 +94,16 @@ public class TestSessionInOutBuffers {
         HttpTransportMetrics tmetrics = outbuffer.getMetrics();
         long bytesWritten = tmetrics.getBytesTransferred();
         long expected = 0;
-        for (int i = 0; i < teststrs.length; i++) {
-            expected += (teststrs[i].length() + 2/*CRLF*/);
+        for (String teststr : teststrs) {
+            expected += (teststr.length() + 2/*CRLF*/);
         }
         Assert.assertEquals(expected, bytesWritten);
 
         SessionInputBufferMock inbuffer = new SessionInputBufferMock(
                 outbuffer.getData());
 
-        for (int i = 0; i < teststrs.length; i++) {
-            Assert.assertEquals(teststrs[i], inbuffer.readLine());
+        for (String teststr : teststrs) {
+            Assert.assertEquals(teststr, inbuffer.readLine());
         }
 
         Assert.assertNull(inbuffer.readLine());
@@ -202,9 +202,9 @@ public class TestSessionInOutBuffers {
 
         CharArrayBuffer chbuffer = new CharArrayBuffer(16);
         SessionOutputBufferMock outbuffer = new SessionOutputBufferMock();
-        for (int i = 0; i < teststrs.length; i++) {
+        for (String teststr : teststrs) {
             chbuffer.clear();
-            chbuffer.append(teststrs[i]);
+            chbuffer.append(teststr);
             outbuffer.writeLine(chbuffer);
         }
         //these write operations should have no effect
@@ -214,16 +214,16 @@ public class TestSessionInOutBuffers {
 
         long bytesWritten = outbuffer.getMetrics().getBytesTransferred();
         long expected = 0;
-        for (int i = 0; i < teststrs.length; i++) {
-            expected += (teststrs[i].length() + 2/*CRLF*/);
+        for (String teststr : teststrs) {
+            expected += (teststr.length() + 2/*CRLF*/);
         }
         Assert.assertEquals(expected, bytesWritten);
 
         SessionInputBufferMock inbuffer = new SessionInputBufferMock(
                 outbuffer.getData(), 1024);
 
-        for (int i = 0; i < teststrs.length; i++) {
-            Assert.assertEquals(teststrs[i], inbuffer.readLine());
+        for (String teststr : teststrs) {
+            Assert.assertEquals(teststr, inbuffer.readLine());
         }
         Assert.assertNull(inbuffer.readLine());
         Assert.assertNull(inbuffer.readLine());
@@ -300,8 +300,8 @@ public class TestSessionInOutBuffers {
             out[i] = (byte)(120 + i);
         }
         SessionOutputBufferMock outbuffer = new SessionOutputBufferMock();
-        for (int i = 0; i < out.length; i++) {
-            outbuffer.write(out[i]);
+        for (byte element : out) {
+            outbuffer.write(element);
         }
         outbuffer.flush();
         long bytesWritten = outbuffer.getMetrics().getBytesTransferred();
@@ -375,8 +375,8 @@ public class TestSessionInOutBuffers {
     private static String constructString(int [] unicodeChars) {
         StringBuilder buffer = new StringBuilder();
         if (unicodeChars != null) {
-            for (int i = 0; i < unicodeChars.length; i++) {
-                buffer.append((char)unicodeChars[i]);
+            for (int unicodeChar : unicodeChars) {
+                buffer.append((char)unicodeChar);
             }
         }
         return buffer.toString();

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/integration/TestSyncHttp.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/integration/TestSyncHttp.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/integration/TestSyncHttp.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/integration/TestSyncHttp.java Thu Nov  8 13:46:24 2012
@@ -724,8 +724,7 @@ public class TestSyncHttp {
         HttpHost host = new HttpHost("localhost", this.server.getPort());
 
         try {
-            for (int i = 0; i < patterns.length; i++) {
-                String pattern = patterns[i];
+            for (String pattern : patterns) {
                 for (int n = 1000; n < 1020; n++) {
                     if (!conn.isOpen()) {
                         client.connect(host, conn);

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestStandardInterceptors.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestStandardInterceptors.java?rev=1407076&r1=1407075&r2=1407076&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestStandardInterceptors.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestStandardInterceptors.java Thu Nov  8 13:46:24 2012
@@ -672,9 +672,9 @@ public class TestStandardInterceptors {
                 HttpStatus.SC_SERVICE_UNAVAILABLE,
                 HttpStatus.SC_NOT_IMPLEMENTED };
 
-        for (int i = 0; i < statusCodes.length; i++) {
+        for (int statusCode : statusCodes) {
             BasicHttpResponse response = new BasicHttpResponse(
-                    HttpVersion.HTTP_1_1, statusCodes[i], "Unreasonable");
+                    HttpVersion.HTTP_1_1, statusCode, "Unreasonable");
             interceptor.process(response, context);
             Header header = response.getFirstHeader(HTTP.CONN_DIRECTIVE);
             Assert.assertNotNull(header);



Mime
View raw message