Program: 76796
Project: 76796
Buggy source:
/** 
 * @param computedColumns
 * @param rsPopulator
 * @param dataSetRuntime
 * @throws DataException
 */
public void evaluateMultiPassExprOnCmp(IComputedColumnsState iccState,boolean useResultSetMeta) throws DataException {
  assert(iccState != null);
  Context context=Context.enter();
  try {
    int exprType=COMPUTED_COLUMN_EXPR;
    int currentGroupLevel=0;
    ExpressionInfo exprInfo;
    MultiPassExpressionCompiler helper=this.getMultiPassCompilerHelper();
    helper.setDataSetMode(isDataSetMode);
    for (int i=0; i < iccState.getCount(); i++) {
      if (iccState.isValueAvailable(i)) {
        helper.addAvailableCmpColumn(iccState.getName(i));
      }
    }
    for (int i=0; i < iccState.getCount(); i++) {
      if (!iccState.isValueAvailable(i)) {
        IBaseExpression baseExpression=iccState.getExpression(i);
        String name=iccState.getName(i);
        if (useResultSetMeta && name.matches("String_Node_Str")) {
          exprType=GROUP_COLUMN_EXPR;
          currentGroupLevel=getCurrentGroupLevel(name,currentGroupLevel,rsPopulator.getQuery());
          iccState.setValueAvailable(i);
        }
        if (baseExpression instanceof IScriptExpression) {
          exprInfo=new ExpressionInfo((IScriptExpression)baseExpression,exprType,currentGroupLevel,useResultSetMeta);
          baseExpression.setHandle(helper.compileExpression(exprInfo,context));
        }
 else         if (baseExpression instanceof IConditionalExpression) {
          compileConditionalExpression((IConditionalExpression)baseExpression,helper,rsPopulator,exprType,currentGroupLevel,context);
        }
        if (exprType == GROUP_COLUMN_EXPR) {
          return;
        }
        if (helper.getExpressionPassLevel() <= 1) {
          iccState.setValueAvailable(i);
        }
 else {
          break;
        }
      }
    }
    calculate(helper);
  }
  finally {
    Context.exit();
  }
}

Fixed version (ground truth):
/** 
 * @param computedColumns
 * @param rsPopulator
 * @param dataSetRuntime
 * @throws DataException
 */
public void evaluateMultiPassExprOnCmp(IComputedColumnsState iccState,boolean useResultSetMeta) throws DataException {
  assert(iccState != null);
  Context context=Context.enter();
  try {
    int exprType=COMPUTED_COLUMN_EXPR;
    int currentGroupLevel=0;
    ExpressionInfo exprInfo;
    MultiPassExpressionCompiler helper=this.getMultiPassCompilerHelper();
    helper.setDataSetMode(isDataSetMode);
    for (int i=0; i < iccState.getCount(); i++) {
      if (iccState.isValueAvailable(i)) {
        helper.addAvailableCmpColumn(iccState.getName(i));
      }
    }
    for (int i=0; i < iccState.getCount(); i++) {
      if (!iccState.isValueAvailable(i)) {
        IBaseExpression baseExpression=iccState.getExpression(i);
        String name=iccState.getName(i);
        if (useResultSetMeta && name.matches("String_Node_Str")) {
          exprType=GROUP_COLUMN_EXPR;
          currentGroupLevel=getCurrentGroupLevel(name,currentGroupLevel,rsPopulator.getQuery());
          iccState.setValueAvailable(i);
        }
        if (baseExpression instanceof IScriptExpression) {
          exprInfo=new ExpressionInfo((IScriptExpression)baseExpression,exprType,currentGroupLevel,useResultSetMeta);
          baseExpression.setHandle(helper.compileExpression(exprInfo,context));
        }
 else         if (baseExpression instanceof IConditionalExpression) {
          compileConditionalExpression((IConditionalExpression)baseExpression,helper,rsPopulator,exprType,currentGroupLevel,context);
        }
        if (exprType == GROUP_COLUMN_EXPR) {
          return;
        }
        if (helper.getExpressionPassLevel() <= 1) {
          iccState.setValueAvailable(i);
        }
        helper.reSetPassLevelFlag();
      }
    }
    calculate(helper);
  }
  finally {
    Context.exit();
  }
}