Author: sebb
Date: Thu Jun 28 17:30:51 2007
New Revision: 551743

URL: http://svn.apache.org/viewvc?view=rev&rev=551743
Log:
Bug 41612 - Loop nested in IF behaves erratically

Modified:
    
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/control/IfController.java
    jakarta/jmeter/branches/rel-2-2/xdocs/changes.xml

Modified: 
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/control/IfController.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/control/IfController.java?view=diff&rev=551743&r1=551742&r2=551743
==============================================================================
--- 
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/control/IfController.java
 (original)
+++ 
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/control/IfController.java
 Thu Jun 28 17:30:51 2007
@@ -137,16 +137,18 @@
        }
 
        /**
-        * @see org.apache.jmeter.control.Controller#next() 'JMeterThread' 
iterates
-        *      thru the Controller by calling this method. IF a valid 
'Sampler' is
-        *      returned, then it executes the sampler (calls 
sampler.sampler(xxx)
-        *      method) . So here we make sure that the samplers belonging to 
this
-        *      Controller do not get called - if isDone is true - if its the 
first
-        *      time this is run. The first time is special cause it is called 
prior
-        *      the iteration even starts !
+        * @see org.apache.jmeter.control.Controller#next()
         */
        public Sampler next() {
-               boolean result = evaluateCondition(getCondition());
+        // We should only evalute the condition if it is the first
+        // time ( first "iteration" ) we are called.
+        // For subsequent calls, we are inside the IfControllerGroup,
+        // so then we just pass the control to the next item inside the if 
control
+        boolean result = true;
+        if(isFirst()) {
+            result = evaluateCondition(getCondition());
+        }
+        
                if (result) {
                        return super.next();
                }
@@ -156,4 +158,4 @@
                        return null;
                }
        }
-}
\ No newline at end of file
+}

Modified: jakarta/jmeter/branches/rel-2-2/xdocs/changes.xml
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-2/xdocs/changes.xml?view=diff&rev=551743&r1=551742&r2=551743
==============================================================================
--- jakarta/jmeter/branches/rel-2-2/xdocs/changes.xml (original)
+++ jakarta/jmeter/branches/rel-2-2/xdocs/changes.xml Thu Jun 28 17:30:51 2007
@@ -263,6 +263,7 @@
 <li>Function methods setParameters() need to be synchronized</li>
 <li>Fix CLI long optional argument to require "=" (as for short options)</li>
 <li>Fix SlowSocket to work properly with Httpclient (both http and https)</li>
+<li>Bug 41612 - Loop nested in IF behaves erratically</li>
 </ul>
 
 <h3>Version 2.2</h3>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to