View | Details | Raw Unified | Return to bug 57981
Collapse All | Expand All

(-)a/src/components/org/apache/jmeter/assertions/SMIMEAssertion.java (-16 / +11 lines)
Lines 31-40 import java.security.cert.CertStore; Link Here
31
import java.security.cert.CertificateException;
31
import java.security.cert.CertificateException;
32
import java.security.cert.CertificateFactory;
32
import java.security.cert.CertificateFactory;
33
import java.security.cert.X509Certificate;
33
import java.security.cert.X509Certificate;
34
import java.util.ArrayList;
34
import java.util.*;
35
import java.util.Iterator;
36
import java.util.List;
37
import java.util.Properties;
38
35
39
import javax.mail.MessagingException;
36
import javax.mail.MessagingException;
40
import javax.mail.Session;
37
import javax.mail.Session;
Lines 303-309 class SMIMEAssertion { Link Here
303
     * 
300
     * 
304
     * @param serialString
301
     * @param serialString
305
     *            the String representation of the serial Number
302
     *            the String representation of the serial Number
306
     * @return
303
     * @return the BitInteger representation of the serial Number
307
     */
304
     */
308
    private static BigInteger readSerialNumber(String serialString) {
305
    private static BigInteger readSerialNumber(String serialString) {
309
        if (serialString.startsWith("0x") || serialString.startsWith("0X")) { // $NON-NLS-1$  // $NON-NLS-2$
306
        if (serialString.startsWith("0x") || serialString.startsWith("0X")) { // $NON-NLS-1$  // $NON-NLS-2$
Lines 315-321 class SMIMEAssertion { Link Here
315
    /**
312
    /**
316
     * Extract email addresses from a certificate
313
     * Extract email addresses from a certificate
317
     * 
314
     * 
318
     * @param cert
315
     * @param cert the X509 certificate
319
     * @return a List of all email addresses found
316
     * @return a List of all email addresses found
320
     * @throws CertificateException
317
     * @throws CertificateException
321
     */
318
     */
Lines 324-340 class SMIMEAssertion { Link Here
324
        List<String> res = new ArrayList<>();
321
        List<String> res = new ArrayList<>();
325
322
326
        X509Principal subject = PrincipalUtil.getSubjectX509Principal(cert);
323
        X509Principal subject = PrincipalUtil.getSubjectX509Principal(cert);
327
        Iterator<?> addressIt = subject.getValues(X509Name.EmailAddress).iterator();
324
        Vector<?> addresses = subject.getValues(X509Name.EmailAddress);
328
        while (addressIt.hasNext()) {
325
        for (Object address: addresses) {
329
            String address = (String) addressIt.next();
326
            res.add((String) address);
330
            res.add(address);
331
        }
327
        }
332
328
333
        Iterator<?> subjectAltNamesIt = 
329
        Collection<?> subjectAltNames =
334
            X509ExtensionUtil.getSubjectAlternativeNames(cert).iterator();
330
            X509ExtensionUtil.getSubjectAlternativeNames(cert);
335
        while (subjectAltNamesIt.hasNext()) {
331
        for (Object altNameObj : subjectAltNames) {
336
            List<?> altName = (List<?>) subjectAltNamesIt.next();
332
            List<?> altName = (List<?>) altNameObj;
337
            int type = ((Integer) altName.get(0)).intValue();
333
            int type = (Integer) altName.get(0);
338
            if (type == GeneralName.rfc822Name) {
334
            if (type == GeneralName.rfc822Name) {
339
                String address = (String) altName.get(1);
335
                String address = (String) altName.get(1);
340
                res.add(address);
336
                res.add(address);
Lines 347-353 class SMIMEAssertion { Link Here
347
    /**
343
    /**
348
     * Check if the Bouncycastle jce provider is installed and dynamically load
344
     * Check if the Bouncycastle jce provider is installed and dynamically load
349
     * it, if needed;
345
     * it, if needed;
350
     * 
351
     */
346
     */
352
    private static void checkForBouncycastle() {
347
    private static void checkForBouncycastle() {
353
        if (null == Security.getProvider("BC")) { // $NON-NLS-1$
348
        if (null == Security.getProvider("BC")) { // $NON-NLS-1$
(-)a/src/components/org/apache/jmeter/control/IncludeController.java (-15 / +8 lines)
Lines 67-75 public class IncludeController extends GenericController implements ReplaceableC Link Here
67
        clone.setIncludePath(this.getIncludePath());
67
        clone.setIncludePath(this.getIncludePath());
68
        if (this.subtree != null) {
68
        if (this.subtree != null) {
69
            if (this.subtree.size() == 1) {
69
            if (this.subtree.size() == 1) {
70
                Iterator<Object> itr = this.subtree.keySet().iterator();
70
                for (Object o : this.subtree.keySet()) {
71
                while (itr.hasNext()) {
71
                    this.sub = (TestElement) o;
72
                    this.sub = (TestElement) itr.next();
73
                }
72
                }
74
            }
73
            }
75
            clone.subtree = (HashTree)this.subtree.clone();
74
            clone.subtree = (HashTree)this.subtree.clone();
Lines 173-190 public class IncludeController extends GenericController implements ReplaceableC Link Here
173
     * @return HashTree Subset within Test Fragment or Empty HashTree
172
     * @return HashTree Subset within Test Fragment or Empty HashTree
174
     */
173
     */
175
    private HashTree getProperBranch(HashTree tree) {
174
    private HashTree getProperBranch(HashTree tree) {
176
        Iterator<Object> iter = new LinkedList<>(tree.list()).iterator();
175
        for (Object o : new LinkedList<>(tree.list())) {
177
        while (iter.hasNext()) {
176
            TestElement item = (TestElement) o;
178
            TestElement item = (TestElement) iter.next();
179
177
180
            //if we found a TestPlan, then we are on our way to the TestFragment
178
            //if we found a TestPlan, then we are on our way to the TestFragment
181
            if (item instanceof TestPlan)
179
            if (item instanceof TestPlan) {
182
            {
183
                return getProperBranch(tree.getTree(item));
180
                return getProperBranch(tree.getTree(item));
184
            }
181
            }
185
182
186
            if (item instanceof TestFragmentController)
183
            if (item instanceof TestFragmentController) {
187
            {
188
                return tree.getTree(item);
184
                return tree.getTree(item);
189
            }
185
            }
190
        }
186
        }
Lines 194-207 public class IncludeController extends GenericController implements ReplaceableC Link Here
194
190
195
191
196
    private void removeDisabledItems(HashTree tree) {
192
    private void removeDisabledItems(HashTree tree) {
197
        Iterator<Object> iter = new LinkedList<>(tree.list()).iterator();
193
        for (Object o : new LinkedList<>(tree.list())) {
198
        while (iter.hasNext()) {
194
            TestElement item = (TestElement) o;
199
            TestElement item = (TestElement) iter.next();
200
            if (!item.isEnabled()) {
195
            if (!item.isEnabled()) {
201
                //log.info("Removing "+item.toString());
202
                tree.remove(item);
196
                tree.remove(item);
203
            } else {
197
            } else {
204
                //log.info("Keeping "+item.toString());
205
                removeDisabledItems(tree.getTree(item));// Recursive call
198
                removeDisabledItems(tree.getTree(item));// Recursive call
206
            }
199
            }
207
        }
200
        }
(-)a/src/components/org/apache/jmeter/visualizers/PropertyControlGui.java (-5 / +2 lines)
Lines 159-169 public class PropertyControlGui extends AbstractConfigGui implements Link Here
159
                return m1.compareTo(m2);
159
                return m1.compareTo(m2);
160
            }
160
            }
161
        });
161
        });
162
        Iterator<Map.Entry<Object, Object>> i = al.iterator();
162
        for (Map.Entry<Object, Object> row : al) {
163
        while (i.hasNext()) {
163
            tableModel.addRow(row);
164
            tableModel.addRow(i.next());
165
        }
164
        }
166
167
    }
165
    }
168
166
169
    @Override
167
    @Override
170
- 

Return to bug 57981