jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fschumac...@apache.org
Subject svn commit: r1697178 - in /jmeter/trunk/src/components/org/apache/jmeter: assertions/SMIMEAssertion.java control/IncludeController.java visualizers/PropertyControlGui.java
Date Sun, 23 Aug 2015 13:16:42 GMT
Author: fschumacher
Date: Sun Aug 23 13:16:41 2015
New Revision: 1697178

URL: http://svn.apache.org/r1697178
Log:
Convert to for loops. Patch by Graham Russel.

Bugzilla Id: 57981

Modified:
    jmeter/trunk/src/components/org/apache/jmeter/assertions/SMIMEAssertion.java
    jmeter/trunk/src/components/org/apache/jmeter/control/IncludeController.java
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/PropertyControlGui.java

Modified: jmeter/trunk/src/components/org/apache/jmeter/assertions/SMIMEAssertion.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/assertions/SMIMEAssertion.java?rev=1697178&r1=1697177&r2=1697178&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/assertions/SMIMEAssertion.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/assertions/SMIMEAssertion.java Sun Aug 23
13:16:41 2015
@@ -32,9 +32,11 @@ import java.security.cert.CertificateExc
 import java.security.cert.CertificateFactory;
 import java.security.cert.X509Certificate;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Properties;
+import java.util.Vector;
 
 import javax.mail.MessagingException;
 import javax.mail.Session;
@@ -324,17 +326,16 @@ class SMIMEAssertion {
         List<String> res = new ArrayList<>();
 
         X509Principal subject = PrincipalUtil.getSubjectX509Principal(cert);
-        Iterator<?> addressIt = subject.getValues(X509Name.EmailAddress).iterator();
-        while (addressIt.hasNext()) {
-            String address = (String) addressIt.next();
-            res.add(address);
+        Vector<?> addresses = subject.getValues(X509Name.EmailAddress);
+        for (Object address: addresses) {
+            res.add((String) address);
         }
 
-        Iterator<?> subjectAltNamesIt = 
-            X509ExtensionUtil.getSubjectAlternativeNames(cert).iterator();
-        while (subjectAltNamesIt.hasNext()) {
-            List<?> altName = (List<?>) subjectAltNamesIt.next();
-            int type = ((Integer) altName.get(0)).intValue();
+        Collection<?> subjectAltNames =
+            X509ExtensionUtil.getSubjectAlternativeNames(cert);
+        for (Object altNameObj : subjectAltNames) {
+            List<?> altName = (List<?>) altNameObj;
+            int type = (Integer) altName.get(0);
             if (type == GeneralName.rfc822Name) {
                 String address = (String) altName.get(1);
                 res.add(address);

Modified: jmeter/trunk/src/components/org/apache/jmeter/control/IncludeController.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/control/IncludeController.java?rev=1697178&r1=1697177&r2=1697178&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/control/IncludeController.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/control/IncludeController.java Sun Aug 23
13:16:41 2015
@@ -67,9 +67,8 @@ public class IncludeController extends G
         clone.setIncludePath(this.getIncludePath());
         if (this.subtree != null) {
             if (this.subtree.size() == 1) {
-                Iterator<Object> itr = this.subtree.keySet().iterator();
-                while (itr.hasNext()) {
-                    this.sub = (TestElement) itr.next();
+                for (Object o : this.subtree.keySet()) {
+                    this.sub = (TestElement) o;
                 }
             }
             clone.subtree = (HashTree)this.subtree.clone();
@@ -173,9 +172,8 @@ public class IncludeController extends G
      * @return HashTree Subset within Test Fragment or Empty HashTree
      */
     private HashTree getProperBranch(HashTree tree) {
-        Iterator<Object> iter = new LinkedList<>(tree.list()).iterator();
-        while (iter.hasNext()) {
-            TestElement item = (TestElement) iter.next();
+        for (Object o : new LinkedList<>(tree.list())) {
+            TestElement item = (TestElement) o;
 
             //if we found a TestPlan, then we are on our way to the TestFragment
             if (item instanceof TestPlan)
@@ -194,9 +192,8 @@ public class IncludeController extends G
 
 
     private void removeDisabledItems(HashTree tree) {
-        Iterator<Object> iter = new LinkedList<>(tree.list()).iterator();
-        while (iter.hasNext()) {
-            TestElement item = (TestElement) iter.next();
+        for (Object o : new LinkedList<>(tree.list())) {
+            TestElement item = (TestElement) o;
             if (!item.isEnabled()) {
                 tree.remove(item);
             } else {

Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/PropertyControlGui.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/PropertyControlGui.java?rev=1697178&r1=1697177&r2=1697178&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/visualizers/PropertyControlGui.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/PropertyControlGui.java Sun
Aug 23 13:16:41 2015
@@ -160,9 +160,8 @@ public class PropertyControlGui extends
                 return m1.compareTo(m2);
             }
         });
-        Iterator<Map.Entry<Object, Object>> i = al.iterator();
-        while (i.hasNext()) {
-            tableModel.addRow(i.next());
+        for (Map.Entry<Object, Object> row : al) {
+            tableModel.addRow(row);
         }
 
     }



Mime
View raw message