jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1206721 - in /jmeter/trunk/src: core/org/apache/jmeter/gui/util/JMeterMenuBar.java core/org/apache/jmeter/threads/JMeterThread.java protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPJavaImpl.java
Date Sun, 27 Nov 2011 13:49:40 GMT
Author: sebb
Date: Sun Nov 27 13:49:39 2011
New Revision: 1206721

URL: http://svn.apache.org/viewvc?rev=1206721&view=rev
Log:
Simplify for loops

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/gui/util/JMeterMenuBar.java
    jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPJavaImpl.java

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/util/JMeterMenuBar.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/util/JMeterMenuBar.java?rev=1206721&r1=1206720&r2=1206721&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/util/JMeterMenuBar.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/util/JMeterMenuBar.java Sun Nov 27 13:49:39
2011
@@ -477,8 +477,8 @@ public class JMeterMenuBar extends JMenu
         // Add the recent files, which will also add a separator that is
         // visible when needed
         file_load_recent_files = LoadRecentProject.getRecentFileMenuItems();
-        for(Iterator<JComponent> i = file_load_recent_files.iterator(); i.hasNext();)
{
-            fileMenu.add(i.next());
+        for(JComponent jc : file_load_recent_files){
+            fileMenu.add(jc);
         }
         fileMenu.add(file_exit);
     }

Modified: jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java?rev=1206721&r1=1206720&r2=1206721&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java Sun Nov 27 13:49:39
2011
@@ -491,13 +491,12 @@ public class JMeterThread implements Run
         if(transactionSampler != null) {
             ArrayList<SampleListener> onlySubSamplerListeners = new ArrayList<SampleListener>();
             List<SampleListener> transListeners = transactionPack.getSampleListeners();
-            for(Iterator<SampleListener> i = sampleListeners.iterator(); i.hasNext();)
{
-                SampleListener listener = i.next();
+            for(SampleListener listener : sampleListeners) {
                 // Check if this instance is present in transaction listener list
                 boolean found = false;
-                for(Iterator<SampleListener> j = transListeners.iterator(); j.hasNext();)
{
+                for(SampleListener trans : transListeners) {
                     // Check for the same instance
-                    if(j.next() == listener) {
+                    if(trans == listener) {
                         found = true;
                         break;
                     }

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPJavaImpl.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPJavaImpl.java?rev=1206721&r1=1206720&r2=1206721&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPJavaImpl.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPJavaImpl.java
Sun Nov 27 13:49:39 2011
@@ -28,10 +28,8 @@ import java.net.Proxy;
 import java.net.URL;
 import java.net.URLConnection;
 
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 import java.util.zip.GZIPInputStream;
 
 import org.apache.commons.io.input.CountingInputStream;
@@ -384,17 +382,15 @@ public class HTTPJavaImpl extends HTTPAb
         // Get all the request properties, which are the headers set on the connection
         StringBuilder hdrs = new StringBuilder(100);
         Map<String, List<String>> requestHeaders = conn.getRequestProperties();
-        Set<Map.Entry<String, List<String>>> headerFields = requestHeaders.entrySet();
-        for(Iterator<Map.Entry<String, List<String>>> i = headerFields.iterator();
i.hasNext();) {
-            Map.Entry<String, List<String>> entry = i.next();
+        for(Map.Entry<String, List<String>> entry : requestHeaders.entrySet())
{
             String headerKey=entry.getKey();
             // Exclude the COOKIE header, since cookie is reported separately in the sample
             if(!HEADER_COOKIE.equalsIgnoreCase(headerKey)) {
-                List<String> values = entry.getValue();// value is a List of Strings
-                for (int j=0;j<values.size();j++){
+                // value is a List of Strings
+                for (String value : entry.getValue()){
                     hdrs.append(headerKey);
                     hdrs.append(": "); // $NON-NLS-1$
-                    hdrs.append(values.get(j));
+                    hdrs.append(value);
                     hdrs.append("\n"); // $NON-NLS-1$
                 }
             }



Mime
View raw message