jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1444567 - /jmeter/trunk/src/core/org/apache/jmeter/control/LoopController.java
Date Sun, 10 Feb 2013 17:07:19 GMT
Author: pmouawad
Date: Sun Feb 10 17:07:19 2013
New Revision: 1444567

URL: http://svn.apache.org/r1444567
Log:
Bug 54467 - Loop controller Controller check conditions each request
Fix test failure
Bugzilla Id: 54467

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/control/LoopController.java

Modified: jmeter/trunk/src/core/org/apache/jmeter/control/LoopController.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/control/LoopController.java?rev=1444567&r1=1444566&r2=1444567&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/control/LoopController.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/control/LoopController.java Sun Feb 10 17:07:19
2013
@@ -31,7 +31,7 @@ import org.apache.jmeter.testelement.pro
  */
 public class LoopController extends GenericController implements Serializable {
 
-    private static final String LOOPS = "LoopController.loops"; // $NON-NLS-1$
+    public static final String LOOPS = "LoopController.loops"; // $NON-NLS-1$
 
     private static final long serialVersionUID = 7833960784370272300L;
 
@@ -67,12 +67,15 @@ public class LoopController extends Gene
     }
 
     public int getLoops() {
-        try {
-            JMeterProperty prop = getProperty(LOOPS);
-            return Integer.parseInt(prop.getStringValue());
-        } catch (NumberFormatException e) {
-            return 0;
+        if(nbLoops==null || nbLoops.intValue()==-1) {
+            try {
+                JMeterProperty prop = getProperty(LOOPS);
+                nbLoops = Integer.valueOf(prop.getStringValue());
+            } catch (NumberFormatException e) {
+                nbLoops = 0;
+            }
         }
+        return nbLoops.intValue();
     }
 
     public String getLoopString() {
@@ -112,11 +115,7 @@ public class LoopController extends Gene
     }
 
     private boolean endOfLoop() {
-        if(nbLoops==null) {
-            // Ensure we compute it only once per parent iteration, see Bug 54467
-            nbLoops = Integer.valueOf(getLoops());
-        }
-        final int loops = nbLoops.intValue();
+        final int loops = getLoops();
         return (loops > -1) && (loopCount >= loops);
     }
 



Mime
View raw message