thads       2004/04/19 12:05:57

  Modified:    src/core/org/apache/jmeter/control IfController.java
  Log:
  Fixed the problem where an IfController was getting removed from the

  test tree if it evaluated to false. Defect 26672.
  
  Revision  Changes    Path
  1.5       +26 -18    
jakarta-jmeter/src/core/org/apache/jmeter/control/IfController.java
  
  Index: IfController.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/control/IfController.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- IfController.java 19 Apr 2004 17:52:30 -0000      1.4
  +++ IfController.java 19 Apr 2004 19:05:56 -0000      1.5
  @@ -143,16 +143,18 @@
           * IsDone indicates whether the termination condition is reached.
           * I.e. if the condition evaluates to False - then isDone() returns TRUE
           */
  -       public boolean isDone() {
  -                     boolean result = true;
  -                     try {
  -                               result = !evaluateCondition();
  -                     } catch (Exception e) {
  -                               logger.error(e.getMessage(), e);
  -                     }
  -                     setDone(true);
  -                     return result;
  -       }
  +     public boolean isDone() {
  +//           boolean result = true;
  +//           try {
  +//                     result = !evaluateCondition();
  +//           } catch (Exception e) {
  +//                     logger.error(e.getMessage(), e);
  +//           }
  +//           setDone(true);
  +//           return result;
  +//           setDone(false);
  +             return false;
  +     }
   
          /**
           * @see org.apache.jmeter.control.Controller#next()
  @@ -166,13 +168,19 @@
           *       cause it is called prior the iteration even starts !
           */
          public Sampler next() {
  -                     Sampler currentElement = super.next();
  -
  -                     if (!isDone()) {
  -                               return currentElement;
  -                     } else {
  -                               return null;
  +                     boolean result = false;
  +                     try {
  +                             result = evaluateCondition();
  +                     }
  +                     catch (Exception e)
  +                     {
  +                             logger.error(e.getMessage(),e);
                        }
  +                     if (result)
  +                             return super.next();
  +                     else
  +                             return null;
  +                             
          }
   
   ////////////////////////////// Start of Test Code ///////////////////////////
  
  
  

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

Reply via email to