jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fschumac...@apache.org
Subject svn commit: r1700120 - in /jmeter/trunk: src/junit/org/apache/jmeter/protocol/java/control/gui/ src/protocol/http/org/apache/jmeter/protocol/http/config/ src/protocol/http/org/apache/jmeter/protocol/http/proxy/ src/protocol/http/org/apache/jmeter/proto...
Date Sun, 30 Aug 2015 13:27:26 GMT
Author: fschumacher
Date: Sun Aug 30 13:27:25 2015
New Revision: 1700120

URL: http://svn.apache.org/r1700120
Log:
Convert to for-loops. Patch based on part 3 from Graham Russell.
Contains a few whitespace changes.

Bugzilla Id: 57981

Modified:
    jmeter/trunk/src/junit/org/apache/jmeter/protocol/java/control/gui/JUnitTestSamplerGui.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/config/MultipartUrlConfig.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/WSDLHelper.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/LogFilter.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/StandardGenerator.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/visualizers/RequestViewHTTP.java
    jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPExtSampler.java
    jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/gui/SmtpPanel.java
    jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java
    jmeter/trunk/test/src/org/apache/jmeter/protocol/http/util/accesslog/TestLogFilter.java
    jmeter/trunk/test/src/org/apache/jorphan/test/AllTests.java

Modified: jmeter/trunk/src/junit/org/apache/jmeter/protocol/java/control/gui/JUnitTestSamplerGui.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/junit/org/apache/jmeter/protocol/java/control/gui/JUnitTestSamplerGui.java?rev=1700120&r1=1700119&r2=1700120&view=diff
==============================================================================
--- jmeter/trunk/src/junit/org/apache/jmeter/protocol/java/control/gui/JUnitTestSamplerGui.java
(original)
+++ jmeter/trunk/src/junit/org/apache/jmeter/protocol/java/control/gui/JUnitTestSamplerGui.java
Sun Aug 30 13:27:25 2015
@@ -185,8 +185,8 @@ implements ChangeListener, ActionListene
             filter.setPackges(JOrphanUtils.split(filterpkg.getText(),",")); //$NON-NLS-1$
             // change the classname drop down
             String[] clist = filter.filterArray(classList);
-            for (int idx=0; idx < clist.length; idx++) {
-                classnameCombo.addItem(clist[idx]);
+            for (String classStr : clist) {
+                classnameCombo.addItem(classStr);
             }
         }
         catch (IOException e)
@@ -360,8 +360,8 @@ implements ChangeListener, ActionListene
                 // Don't instantiate class
                 Class<?> testClass = Class.forName(className, false, contextClassLoader);
                 String [] names = getMethodNames(testClass);
-                for (int idx=0; idx < names.length; idx++){
-                    methodName.addItem(names[idx]);
+                for (String name : names) {
+                    methodName.addItem(name);
                 }
                 methodName.repaint();
             } catch (ClassNotFoundException e) {
@@ -373,8 +373,7 @@ implements ChangeListener, ActionListene
     {
         Method[] meths = clazz.getMethods();
         List<String> list = new ArrayList<>();
-        for (int idx=0; idx < meths.length; idx++){
-            final Method method = meths[idx];
+        for (final Method method : meths) {
             final String name = method.getName();
             if (junit4.isSelected()){
                 if (method.isAnnotationPresent(Test.class) ||

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/config/MultipartUrlConfig.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/config/MultipartUrlConfig.java?rev=1700120&r1=1700119&r2=1700120&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/config/MultipartUrlConfig.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/config/MultipartUrlConfig.java
Sun Aug 30 13:27:25 2015
@@ -122,9 +122,9 @@ public class MultipartUrlConfig implemen
      */
     public void parseArguments(String queryString) {
         String[] parts = JOrphanUtils.split(queryString, "--" + getBoundary()); //$NON-NLS-1$
-        for (int i = 0; i < parts.length; i++) {
-            String contentDisposition = getHeaderValue("Content-disposition", parts[i]);
//$NON-NLS-1$
-            String contentType = getHeaderValue("Content-type", parts[i]); //$NON-NLS-1$
+        for (String part : parts) {
+            String contentDisposition = getHeaderValue("Content-disposition", part); //$NON-NLS-1$
+            String contentType = getHeaderValue("Content-type", part); //$NON-NLS-1$
             // Check if it is form data
             if (contentDisposition != null && contentDisposition.indexOf("form-data")
> -1) { //$NON-NLS-1$
                 // Get the form field name
@@ -151,13 +151,13 @@ public class MultipartUrlConfig implemen
                     // Code also allows for LF only (not sure why - perhaps because the test
code uses it?)
                     final String LF = "\n";
                     final String LFLF = "\n\n";
-                    int indexEmptyCrLfCrLfLinePos = parts[i].indexOf(CRLFCRLF); //$NON-NLS-1$
-                    int indexEmptyLfLfLinePos = parts[i].indexOf(LFLF); //$NON-NLS-1$
+                    int indexEmptyCrLfCrLfLinePos = part.indexOf(CRLFCRLF); //$NON-NLS-1$
+                    int indexEmptyLfLfLinePos = part.indexOf(LFLF); //$NON-NLS-1$
                     String value = null;
-                    if(indexEmptyCrLfCrLfLinePos > -1) {// CRLF blank line found
-                        value = parts[i].substring(indexEmptyCrLfCrLfLinePos+CRLFCRLF.length(),parts[i].lastIndexOf(CRLF));
-                    } else if(indexEmptyLfLfLinePos > -1) { // LF blank line found
-                        value = parts[i].substring(indexEmptyLfLfLinePos+LFLF.length(),parts[i].lastIndexOf(LF));
+                    if (indexEmptyCrLfCrLfLinePos > -1) {// CRLF blank line found
+                        value = part.substring(indexEmptyCrLfCrLfLinePos + CRLFCRLF.length(),
part.lastIndexOf(CRLF));
+                    } else if (indexEmptyLfLfLinePos > -1) { // LF blank line found
+                        value = part.substring(indexEmptyLfLfLinePos + LFLF.length(), part.lastIndexOf(LF));
                     }
                     this.addNonEncodedArgument(name, value);
                 }

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java?rev=1700120&r1=1700119&r2=1700120&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java Sun Aug
30 13:27:25 2015
@@ -549,9 +549,8 @@ public class Proxy extends Thread {
             headerLines[contentLengthIndex]=HTTPConstants.HEADER_CONTENT_LENGTH+": "+res.getResponseData().length;
         }
         StringBuilder sb = new StringBuilder(headers.length());
-        for (int i=0;i<headerLines.length;i++){
-            String line=headerLines[i];
-            if (line != null){
+        for (String line : headerLines) {
+            if (line != null) {
                 sb.append(line).append(CRLF_STRING);
             }
         }

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java?rev=1700120&r1=1700119&r2=1700120&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
Sun Aug 30 13:27:25 2015
@@ -1196,9 +1196,7 @@ public class ProxyControl extends Generi
                 continue; // go on with next property.
             }
 
-            for (Iterator<ConfigTestElement> configs = configurations.iterator(); configs.hasNext();)
{
-                ConfigTestElement config = configs.next();
-
+            for (ConfigTestElement config : configurations) {
                 String configValue = config.getPropertyAsString(name);
 
                 if (configValue != null && configValue.length() > 0) {
@@ -1258,9 +1256,9 @@ public class ProxyControl extends Generi
     private void replaceValues(TestElement sampler, TestElement[] configs, Collection<Arguments>
variables) {
         // Build the replacer from all the variables in the collection:
         ValueReplacer replacer = new ValueReplacer();
-        for (Iterator<Arguments> vars = variables.iterator(); vars.hasNext();) {
-            final Map<String, String> map = vars.next().getArgumentsAsMap();
-            for (Iterator<String> vals = map.values().iterator(); vals.hasNext();){
+        for (Arguments variable : variables) {
+            final Map<String, String> map = variable.getArgumentsAsMap();
+            for (Iterator<String> vals = map.values().iterator(); vals.hasNext(); )
{
                final Object next = vals.next();
                if ("".equals(next)) {// Drop any empty values (Bug 45199)
                    vals.remove();
@@ -1272,9 +1270,9 @@ public class ProxyControl extends Generi
         try {
             boolean cachedRegexpMatch = regexMatch;
             replacer.reverseReplace(sampler, cachedRegexpMatch);
-            for (int i = 0; i < configs.length; i++) {
-                if (configs[i] != null) {
-                    replacer.reverseReplace(configs[i], cachedRegexpMatch);
+            for (TestElement config : configs) {
+                if (config != null) {
+                    replacer.reverseReplace(config, cachedRegexpMatch);
                 }
             }
         } catch (InvalidVariableException e) {

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java?rev=1700120&r1=1700119&r2=1700120&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java
Sun Aug 30 13:27:25 2015
@@ -385,8 +385,8 @@ public class HTTPHC3Impl extends HTTPHCA
     private static int calculateHeadersSize(HttpMethodBase httpMethod) {
         int headerSize = httpMethod.getStatusLine().toString().length()+2; // add a \r\n
         Header[] rh = httpMethod.getResponseHeaders();
-        for (int i = 0; i < rh.length; i++) {
-            headerSize += rh[i].toString().length(); // already include the \r\n
+        for (Header responseHeader : rh) {
+            headerSize += responseHeader.toString().length(); // already include the \r\n
         }
         headerSize += 2; // last \r\n before response data
         return headerSize;
@@ -574,11 +574,11 @@ public class HTTPHC3Impl extends HTTPHCA
         headerBuf.append(method.getStatusLine());// header[0] is not the status line...
         headerBuf.append("\n"); // $NON-NLS-1$
 
-        for (int i = 0; i < rh.length; i++) {
-            String key = rh[i].getName();
+        for (Header responseHeader : rh) {
+            String key = responseHeader.getName();
             headerBuf.append(key);
             headerBuf.append(": "); // $NON-NLS-1$
-            headerBuf.append(rh[i].getValue());
+            headerBuf.append(responseHeader.getValue());
             headerBuf.append("\n"); // $NON-NLS-1$
         }
         return headerBuf.toString();
@@ -660,12 +660,12 @@ public class HTTPHC3Impl extends HTTPHCA
         // Get all the request headers
         StringBuilder hdrs = new StringBuilder(100);
         Header[] requestHeaders = method.getRequestHeaders();
-        for(int i = 0; i < requestHeaders.length; i++) {
+        for (Header requestHeader : requestHeaders) {
             // Exclude the COOKIE header, since cookie is reported separately in the sample
-            if(!HTTPConstants.HEADER_COOKIE.equalsIgnoreCase(requestHeaders[i].getName()))
{
-                hdrs.append(requestHeaders[i].getName());
+            if (!HTTPConstants.HEADER_COOKIE.equalsIgnoreCase(requestHeader.getName())) {
+                hdrs.append(requestHeader.getName());
                 hdrs.append(": "); // $NON-NLS-1$
-                hdrs.append(requestHeaders[i].getValue());
+                hdrs.append(requestHeader.getValue());
                 hdrs.append("\n"); // $NON-NLS-1$
             }
         }
@@ -770,8 +770,7 @@ public class HTTPHC3Impl extends HTTPHCA
             }
 
             // Add any files
-            for (int i=0; i < files.length; i++) {
-                HTTPFileArg file = files[i];
+            for (HTTPFileArg file : files) {
                 File inputFile = FileServer.getFileServer().getResolvedFile(file.getPath());
                 // We do not know the char set of the file to be uploaded, so we set it to
null
                 ViewableFilePart filePart = new ViewableFilePart(file.getParamName(), inputFile,
file.getMimeType(), null);
@@ -1102,8 +1101,8 @@ public class HTTPHC3Impl extends HTTPHCA
     protected void saveConnectionCookies(HttpMethod method, URL u, CookieManager cookieManager)
{
         if (cookieManager != null) {
             Header hdr[] = method.getResponseHeaders(HTTPConstants.HEADER_SET_COOKIE);
-            for (int i = 0; i < hdr.length; i++) {
-                cookieManager.addCookieFromHeader(hdr[i].getValue(),u);
+            for (Header responseHeader : hdr) {
+                cookieManager.addCookieFromHeader(responseHeader.getValue(), u);
             }
         }
     }

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java?rev=1700120&r1=1700119&r2=1700120&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
Sun Aug 30 13:27:25 2015
@@ -820,10 +820,10 @@ public class HTTPHC4Impl extends HTTPHCA
         headerBuf.append(response.getStatusLine());// header[0] is not the status line...
         headerBuf.append("\n"); // $NON-NLS-1$
 
-        for (int i = 0; i < rh.length; i++) {
-            headerBuf.append(rh[i].getName());
+        for (Header responseHeader : rh) {
+            headerBuf.append(responseHeader.getName());
             headerBuf.append(": "); // $NON-NLS-1$
-            headerBuf.append(rh[i].getValue());
+            headerBuf.append(responseHeader.getValue());
             headerBuf.append("\n"); // $NON-NLS-1$
         }
         return headerBuf.toString();
@@ -932,12 +932,12 @@ public class HTTPHC4Impl extends HTTPHCA
             // Get all the request headers
             StringBuilder hdrs = new StringBuilder(100);
             Header[] requestHeaders = method.getAllHeaders();
-            for(int i = 0; i < requestHeaders.length; i++) {
+            for (Header requestHeader : requestHeaders) {
                 // Exclude the COOKIE header, since cookie is reported separately in the
sample
-                if(!HTTPConstants.HEADER_COOKIE.equalsIgnoreCase(requestHeaders[i].getName()))
{
-                    hdrs.append(requestHeaders[i].getName());
+                if (!HTTPConstants.HEADER_COOKIE.equalsIgnoreCase(requestHeader.getName()))
{
+                    hdrs.append(requestHeader.getName());
                     hdrs.append(": "); // $NON-NLS-1$
-                    hdrs.append(requestHeaders[i].getValue());
+                    hdrs.append(requestHeader.getValue());
                     hdrs.append("\n"); // $NON-NLS-1$
                 }
             }

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java?rev=1700120&r1=1700119&r2=1700120&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java
Sun Aug 30 13:27:25 2015
@@ -104,8 +104,8 @@ public class HTTPSampleResult extends Sa
          */
         final String[] REDIRECT_CODES = { "301", "302", "303" };
         String code = getResponseCode();
-        for (int i = 0; i < REDIRECT_CODES.length; i++) {
-            if (REDIRECT_CODES[i].equals(code)) {
+        for (String redirectCode : REDIRECT_CODES) {
+            if (redirectCode.equals(code)) {
                 return true;
             }
         }

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java?rev=1700120&r1=1700119&r2=1700120&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
Sun Aug 30 13:27:25 2015
@@ -307,20 +307,18 @@ public abstract class HTTPSamplerBase ex
 
     static{
         String []parsers = JOrphanUtils.split(RESPONSE_PARSERS, " " , true);// returns empty
array for null
-        for (int i=0;i<parsers.length;i++){
-            final String parser = parsers[i];
-            String classname=JMeterUtils.getProperty(parser+".className");//$NON-NLS-1$
-            if (classname == null){
-                log.info("Cannot find .className property for "+parser+", using default");
-                classname="";
-            }
-            String typelist=JMeterUtils.getProperty(parser+".types");//$NON-NLS-1$
-            if (typelist != null){
-                String []types=JOrphanUtils.split(typelist, " " , true);
-                for (int j=0;j<types.length;j++){
-                    final String type = types[j];
-                    log.info("Parser for "+type+" is "+classname);
-                    parsersForType.put(type,classname);
+        for (final String parser : parsers) {
+            String classname = JMeterUtils.getProperty(parser + ".className");//$NON-NLS-1$
+            if (classname == null) {
+                log.info("Cannot find .className property for " + parser + ", using default");
+                classname = "";
+            }
+            String typelist = JMeterUtils.getProperty(parser + ".types");//$NON-NLS-1$
+            if (typelist != null) {
+                String[] types = JOrphanUtils.split(typelist, " ", true);
+                for (final String type : types) {
+                    log.info("Parser for " + type + " is " + classname);
+                    parsersForType.put(type, classname);
                 }
             } else {
                 log.warn("Cannot find .types property for "+parser);
@@ -1060,9 +1058,9 @@ public abstract class HTTPSamplerBase ex
     public void parseArguments(String queryString, String contentEncoding) {
         String[] args = JOrphanUtils.split(queryString, QRY_SEP);
         final boolean isDebug = log.isDebugEnabled();
-        for (int i = 0; i < args.length; i++) {
+        for (String arg : args) {
             if (isDebug) {
-                log.debug("Arg: " + args[i]);
+                log.debug("Arg: " + arg);
             }
             // need to handle four cases:
             // - string contains name=value
@@ -1073,17 +1071,17 @@ public abstract class HTTPSamplerBase ex
             String metaData; // records the existance of an equal sign
             String name;
             String value;
-            int length = args[i].length();
-            int endOfNameIndex = args[i].indexOf(ARG_VAL_SEP);
+            int length = arg.length();
+            int endOfNameIndex = arg.indexOf(ARG_VAL_SEP);
             if (endOfNameIndex != -1) {// is there a separator?
                 // case of name=value, name=
                 metaData = ARG_VAL_SEP;
-                name = args[i].substring(0, endOfNameIndex);
-                value = args[i].substring(endOfNameIndex + 1, length);
+                name = arg.substring(0, endOfNameIndex);
+                value = arg.substring(endOfNameIndex + 1, length);
             } else {
                 metaData = "";
-                name=args[i];
-                value="";
+                name = arg;
+                value = "";
             }
             if (name.length() > 0) {
                 if (isDebug) {
@@ -1533,8 +1531,8 @@ public abstract class HTTPSamplerBase ex
             }
             if (lastRes.getSubResults() != null && lastRes.getSubResults().length
> 0) {
                 SampleResult[] subs = lastRes.getSubResults();
-                for (int i = 0; i < subs.length; i++) {
-                    totalRes.addSubResult(subs[i]);
+                for (SampleResult sub : subs) {
+                    totalRes.addSubResult(sub);
                 }
             } else {
                 // Only add sample if it is a sample of valid url redirect, i.e. that
@@ -1695,9 +1693,8 @@ public abstract class HTTPSamplerBase ex
         HTTPFileArgs fileArgs = new HTTPFileArgs();
         // Weed out the empty files
         if (files.length > 0) {
-            for(int i=0; i < files.length; i++){
-                HTTPFileArg file = files[i];
-                if (file.isNotEmpty()){
+            for (HTTPFileArg file : files) {
+                if (file.isNotEmpty()) {
                     fileArgs.addHTTPFileArg(file);
                 }
             }
@@ -1834,8 +1831,8 @@ public abstract class HTTPSamplerBase ex
             // Now deal with any additional file arguments
             if(fileArgs != null) {
                 HTTPFileArg[] infiles = fileArgs.asArray();
-                for (int i = 0; i < infiles.length; i++){
-                    allFileArgs.addHTTPFileArg(infiles[i]);
+                for (HTTPFileArg infile : infiles) {
+                    allFileArgs.addHTTPFileArg(infile);
                 }
             }
         } else {

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/WSDLHelper.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/WSDLHelper.java?rev=1700120&r1=1700119&r2=1700120&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/WSDLHelper.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/WSDLHelper.java Sun
Aug 30 13:27:25 2015
@@ -267,9 +267,9 @@ public class WSDLHelper {
      * @return list of web methods
      */
     public String[] getWebMethods() {
-        for (int idx = 0; idx < SOAPOPS.length; idx++) {
+        for (Object soapOp : SOAPOPS) {
             // get the node
-            Node act = (Node) SOAPOPS[idx];
+            Node act = (Node) soapOp;
             // get the soap:operation
             NodeList opers = ((Element) act).getElementsByTagNameNS(SOAP11_BINDING_NAMESPACE,
"operation");
             if (opers.getLength() == 0) {
@@ -360,8 +360,8 @@ public class WSDLHelper {
         Object[] res = this.getSOAPBindings();
         List<Element> ops = new ArrayList<>();
         // first we iterate through the bindings
-        for (int idx = 0; idx < res.length; idx++) {
-            Element one = (Element) res[idx];
+        for (Object r : res) {
+            Element one = (Element) r;
             NodeList opnodes = one.getElementsByTagNameNS(WSDL_NAMESPACE, "operation");
             // now we iterate through the operations
             for (int idz = 0; idz < opnodes.getLength(); idz++) {
@@ -411,8 +411,8 @@ public class WSDLHelper {
             help.parse();
             String[] methods = help.getWebMethods();
             System.out.println("el: " + (System.currentTimeMillis() - start));
-            for (int idx = 0; idx < methods.length; idx++) {
-                System.out.println("method name: " + methods[idx]);
+            for (String method : methods) {
+                System.out.println("method name: " + method);
             }
             System.out.println("service url: " + help.getBinding());
             System.out.println("protocol: " + help.getProtocol());

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/LogFilter.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/LogFilter.java?rev=1700120&r1=1700119&r2=1700120&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/LogFilter.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/LogFilter.java
Sun Aug 30 13:27:25 2015
@@ -178,8 +178,8 @@ public class LogFilter implements Filter
             this.PTRNFILTER = true;
             // now we create the compiled pattern and
             // add it to the arraylist
-            for (int idx = 0; idx < INCPTRN.length; idx++) {
-                this.INCPATTERNS.add(this.createPattern(INCPTRN[idx]));
+            for (String includePattern : INCPTRN) {
+                this.INCPATTERNS.add(this.createPattern(includePattern));
             }
         }
     }
@@ -201,8 +201,8 @@ public class LogFilter implements Filter
             this.PTRNFILTER = true;
             // now we create the compiled pattern and
             // add it to the arraylist
-            for (int idx = 0; idx < EXCPTRN.length; idx++) {
-                this.EXCPATTERNS.add(this.createPattern(EXCPTRN[idx]));
+            for (String excludePattern : EXCPTRN) {
+                this.EXCPATTERNS.add(this.createPattern(excludePattern));
             }
         }
     }
@@ -270,8 +270,8 @@ public class LogFilter implements Filter
         // usefile is set to false unless it
         // matches.
         this.USEFILE = false;
-        for (int idx = 0; idx < this.INCFILE.length; idx++) {
-            if (text.indexOf(this.INCFILE[idx]) > -1) {
+        for (String includeFile : this.INCFILE) {
+            if (text.indexOf(includeFile) > -1) {
                 this.USEFILE = true;
                 break;
             }
@@ -295,8 +295,8 @@ public class LogFilter implements Filter
         // it matches.
         this.USEFILE = true;
         boolean exc = false;
-        for (int idx = 0; idx < this.EXCFILE.length; idx++) {
-            if (text.indexOf(this.EXCFILE[idx]) > -1) {
+        for (String excludeFile : this.EXCFILE) {
+            if (text.indexOf(excludeFile) > -1) {
                 exc = true;
                 this.USEFILE = false;
                 break;
@@ -332,8 +332,8 @@ public class LogFilter implements Filter
      */
     protected boolean incPattern(String text) {
         this.USEFILE = false;
-        for (int idx = 0; idx < this.INCPATTERNS.size(); idx++) {
-            if (JMeterUtils.getMatcher().contains(text, this.INCPATTERNS.get(idx))) {
+        for (Pattern includePattern : this.INCPATTERNS) {
+            if (JMeterUtils.getMatcher().contains(text, includePattern)) {
                 this.USEFILE = true;
                 break;
             }
@@ -351,8 +351,8 @@ public class LogFilter implements Filter
     protected boolean excPattern(String text) {
         this.USEFILE = true;
         boolean exc = false;
-        for (int idx = 0; idx < this.EXCPATTERNS.size(); idx++) {
-            if (JMeterUtils.getMatcher().contains(text, this.EXCPATTERNS.get(idx))) {
+        for (Pattern excludePattern : this.EXCPATTERNS) {
+            if (JMeterUtils.getMatcher().contains(text, excludePattern)) {
                 exc = true;
                 this.USEFILE = false;
                 break;

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/StandardGenerator.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/StandardGenerator.java?rev=1700120&r1=1700119&r2=1700120&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/StandardGenerator.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/StandardGenerator.java
Sun Aug 30 13:27:25 2015
@@ -152,8 +152,8 @@ public class StandardGenerator implement
      */
     @Override
     public void setParams(NVPair[] params) {
-        for (int idx = 0; idx < params.length; idx++) {
-            SAMPLE.addArgument(params[idx].getName(), params[idx].getValue());
+        for (NVPair param : params) {
+            SAMPLE.addArgument(param.getName(), param.getValue());
         }
     }
 

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/visualizers/RequestViewHTTP.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/visualizers/RequestViewHTTP.java?rev=1700120&r1=1700119&r2=1700120&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/visualizers/RequestViewHTTP.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/visualizers/RequestViewHTTP.java
Sun Aug 30 13:27:25 2015
@@ -24,7 +24,6 @@ import java.io.UnsupportedEncodingExcept
 import java.net.URL;
 import java.net.URLDecoder;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.Map.Entry;
@@ -209,9 +208,8 @@ public class RequestViewHTTP implements
             }
             // Parsed request headers
             LinkedHashMap<String, String> lhm = JMeterUtils.parseHeaders(sampleResult.getRequestHeaders());
-            for (Iterator<Map.Entry<String, String>> iterator = lhm.entrySet().iterator();
iterator.hasNext();) {
-                Map.Entry<String, String> entry = iterator.next();
-                headersModel.addRow(new RowResult(entry.getKey(), entry.getValue()));   
+            for (Entry<String, String> entry : lhm.entrySet()) {
+                headersModel.addRow(new RowResult(entry.getKey(), entry.getValue()));
             }
 
         } else {

Modified: jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPExtSampler.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPExtSampler.java?rev=1700120&r1=1700119&r2=1700120&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPExtSampler.java
(original)
+++ jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPExtSampler.java
Sun Aug 30 13:27:25 2015
@@ -24,7 +24,6 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -899,9 +898,7 @@ public class LDAPExtSampler extends Abst
 
             sortResults(sortedResults);
 
-            for (Iterator<SearchResult> it = sortedResults.iterator(); it.hasNext();)
-            {
-                final SearchResult  sr = it.next();
+            for (final SearchResult sr : sortedResults) {
                 writeSearchResult(sr, xmlb);
             }
         }
@@ -934,16 +931,13 @@ public class LDAPExtSampler extends Abst
                 sortedAttrs.add(attr);
             }
             sortAttributes(sortedAttrs);
-            for (Iterator<Attribute> ait = sortedAttrs.iterator(); ait.hasNext();)
-            {
-                final Attribute     attr = ait.next();
-
+            for (final Attribute attr : sortedAttrs) {
                 StringBuilder sb = new StringBuilder();
                 if (attr.size() == 1) {
                     sb.append(getWriteValue(attr.get()));
                 } else {
-                    final ArrayList<String>     sortedVals = new ArrayList<>(attr.size());
-                    boolean             first = true;
+                    final ArrayList<String> sortedVals = new ArrayList<>(attr.size());
+                    boolean first = true;
 
                     for (NamingEnumeration<?> ven = attr.getAll(); ven.hasMore(); )
                     {
@@ -953,9 +947,8 @@ public class LDAPExtSampler extends Abst
 
                     Collections.sort(sortedVals);
 
-                    for (Iterator<String> vit = sortedVals.iterator(); vit.hasNext();)
+                    for (final String value : sortedVals)
                     {
-                        final String    value = vit.next();
                         if (first) {
                             first = false;
                         } else {

Modified: jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/gui/SmtpPanel.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/gui/SmtpPanel.java?rev=1700120&r1=1700119&r2=1700120&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/gui/SmtpPanel.java
(original)
+++ jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/gui/SmtpPanel.java
Sun Aug 30 13:27:25 2015
@@ -498,8 +498,7 @@ public class SmtpPanel extends JPanel {
     public CollectionProperty getHeaderFields() {
         CollectionProperty result = new CollectionProperty();
         result.setName(SmtpSampler.HEADER_FIELDS);
-        for (Iterator<JTextField> iterator = headerFields.keySet().iterator(); iterator.hasNext();)
{
-            JTextField headerName = iterator.next();
+        for (JTextField headerName : headerFields.keySet()) {
             String name = headerName.getText();
             String value = headerFields.get(headerName).getText();
             Argument argument = new Argument(name, value);

Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java?rev=1700120&r1=1700119&r2=1700120&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java Sun Aug
30 13:27:25 2015
@@ -259,13 +259,13 @@ public class TestHTMLParser extends JMet
             suite.addTest(new TestHTMLParser("testNotParser"));
             suite.addTest(new TestHTMLParser("testNotCreatable"));
             suite.addTest(new TestHTMLParser("testNotCreatableStatic"));
-            for (int i = 0; i < PARSERS.length; i++) {
-                TestSuite ps = new TestSuite(PARSERS[i]);// Identify subtests
-                ps.addTest(new TestHTMLParser("testParserProperty", PARSERS[i], 0));
+            for (String parser : PARSERS) {
+                TestSuite ps = new TestSuite(parser);// Identify subtests
+                ps.addTest(new TestHTMLParser("testParserProperty", parser, 0));
                 for (int j = 0; j < TESTS.length; j++) {
                     TestSuite ts = new TestSuite(TESTS[j].fileName);
-                    ts.addTest(new TestHTMLParser("testParserSet", PARSERS[i], j));
-                    ts.addTest(new TestHTMLParser("testParserList", PARSERS[i], j));
+                    ts.addTest(new TestHTMLParser("testParserSet", parser, j));
+                    ts.addTest(new TestHTMLParser("testParserList", parser, j));
                     ps.addTest(ts);
                 }
                 suite.addTest(ps);

Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/util/accesslog/TestLogFilter.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/util/accesslog/TestLogFilter.java?rev=1700120&r1=1700119&r2=1700120&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/util/accesslog/TestLogFilter.java
(original)
+++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/util/accesslog/TestLogFilter.java
Sun Aug 30 13:27:25 2015
@@ -89,8 +89,7 @@ public class TestLogFilter extends JMete
 
         public void testExcludeFiles() {
             testf.excludeFiles(INCL);
-            for (int idx = 0; idx < TESTDATA.length; idx++) {
-                TestData td = TESTDATA[idx];
+            for (TestData td : TESTDATA) {
                 String theFile = td.file;
                 boolean expect = td.exclfile;
 
@@ -106,8 +105,7 @@ public class TestLogFilter extends JMete
 
         public void testIncludeFiles() {
             testf.includeFiles(INCL);
-            for (int idx = 0; idx < TESTDATA.length; idx++) {
-                TestData td = TESTDATA[idx];
+            for (TestData td : TESTDATA) {
                 String theFile = td.file;
                 boolean expect = td.inclfile;
 
@@ -124,8 +122,7 @@ public class TestLogFilter extends JMete
 
         public void testExcludePattern() {
             testf.excludePattern(PATTERNS);
-            for (int idx = 0; idx < TESTDATA.length; idx++) {
-                TestData td = TESTDATA[idx];
+            for (TestData td : TESTDATA) {
                 String theFile = td.file;
                 boolean expect = td.exclpatt;
 
@@ -141,8 +138,7 @@ public class TestLogFilter extends JMete
 
         public void testIncludePattern() {
             testf.includePattern(PATTERNS);
-            for (int idx = 0; idx < TESTDATA.length; idx++) {
-                TestData td = TESTDATA[idx];
+            for (TestData td : TESTDATA) {
                 String theFile = td.file;
                 boolean expect = td.inclpatt;
 

Modified: jmeter/trunk/test/src/org/apache/jorphan/test/AllTests.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jorphan/test/AllTests.java?rev=1700120&r1=1700119&r2=1700120&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jorphan/test/AllTests.java (original)
+++ jmeter/trunk/test/src/org/apache/jorphan/test/AllTests.java Sun Aug 30 13:27:25 2015
@@ -170,10 +170,10 @@ public final class AllTests {
         String cpe[] = JOrphanUtils.split(cp, java.io.File.pathSeparator);
         StringBuilder sb = new StringBuilder(3000);
         sb.append("java.class.path=");
-        for (int i = 0; i < cpe.length; i++) {
+        for (String path : cpe) {
             sb.append("\n");
-            sb.append(cpe[i]);
-            if (new java.io.File(cpe[i]).exists()) {
+            sb.append(path);
+            if (new File(path).exists()) {
                 sb.append(" - OK");
             } else {
                 sb.append(" - ??");



Mime
View raw message