Program: 65701
Project: 65701
Buggy source:
private void populateFilterHelpers() throws DataException {
  List filters=defn.getFilters();
  Set<DimLevel> dimLevelInCubeQuery=this.getDimLevelsDefinedInCubeQuery();
  validateFilter(filters,defn.getBindings());
  for (int i=0; i < filters.size(); i++) {
    IFilterDefinition filter=(IFilterDefinition)filters.get(i);
    if (!filter.updateAggregation()) {
      Set dimLevelSet=OlapExpressionCompiler.getReferencedDimLevel(filter.getExpression(),defn.getBindings());
      if (dimLevelSet.size() <= 1) {
        continue;
      }
 else {
        if (!adjustCubeFilterUpdateAggregationFlag(filter,dimLevelSet))         continue;
      }
    }
switch (this.getFilterType(filter,dimLevelInCubeQuery)) {
case CubeQueryExecutor.DIMENSION_FILTER:
{
        SimpleLevelFilter simpleLevelfilter=createSimpleLevelFilter(filter,defn.getBindings());
        if (simpleLevelfilter == null) {
          this.dimensionFilterEvalHelpers.add(BaseDimensionFilterEvalHelper.createFilterHelper(this.outResults,this.scope,defn,filter,this.session.getEngineContext().getScriptContext()));
        }
 else {
          boolean existLevelFilter=false;
          for (int j=0; j < this.dimensionSimpleFilter.size(); j++) {
            if (dimensionSimpleFilter.get(j).getDimensionName().equals(simpleLevelfilter.getDimensionName()) && dimensionSimpleFilter.get(j).getLevelName().equals(simpleLevelfilter.getLevelName())) {
              this.dimensionFilterEvalHelpers.add(BaseDimensionFilterEvalHelper.createFilterHelper(this.outResults,this.scope,defn,filter,this.session.getEngineContext().getScriptContext()));
              existLevelFilter=true;
              break;
            }
          }
          if (!existLevelFilter)           this.dimensionSimpleFilter.add(simpleLevelfilter);
        }
        break;
      }
case CubeQueryExecutor.AGGR_MEASURE_FILTER:
{
      this.aggrMeasureFilterEvalHelpers.add(new AggrMeasureFilterEvalHelper(this.outResults,scope,defn,filter,session.getEngineContext().getScriptContext()));
      break;
    }
case CubeQueryExecutor.FACTTABLE_FILTER:
default :
{
    this.advancedFacttableBasedFilterEvalHelper.add(new JSFacttableFilterEvalHelper(scope,this.session.getEngineContext().getScriptContext(),filter,this.outResults,this.defn));
  }
}
}
}

Fixed version (ground truth):
public void populateFilterHelpers() throws DataException {
  if (populateFilter)   return;
  List filters=defn.getFilters();
  Set<DimLevel> dimLevelInCubeQuery=this.getDimLevelsDefinedInCubeQuery();
  validateFilter(filters,defn.getBindings());
  for (int i=0; i < filters.size(); i++) {
    IFilterDefinition filter=(IFilterDefinition)filters.get(i);
    if (!filter.updateAggregation()) {
      Set dimLevelSet=OlapExpressionCompiler.getReferencedDimLevel(filter.getExpression(),defn.getBindings());
      if (dimLevelSet.size() <= 1) {
        continue;
      }
 else {
        if (!adjustCubeFilterUpdateAggregationFlag(filter,dimLevelSet))         continue;
      }
    }
switch (this.getFilterType(filter,dimLevelInCubeQuery)) {
case CubeQueryExecutor.DIMENSION_FILTER:
{
        SimpleLevelFilter simpleLevelfilter=createSimpleLevelFilter(filter,defn.getBindings());
        if (simpleLevelfilter == null) {
          this.dimensionFilterEvalHelpers.add(BaseDimensionFilterEvalHelper.createFilterHelper(this.outResults,this.scope,defn,filter,this.session.getEngineContext().getScriptContext()));
        }
 else {
          boolean existLevelFilter=false;
          for (int j=0; j < this.dimensionSimpleFilter.size(); j++) {
            if (dimensionSimpleFilter.get(j).getDimensionName().equals(simpleLevelfilter.getDimensionName()) && dimensionSimpleFilter.get(j).getLevelName().equals(simpleLevelfilter.getLevelName())) {
              this.dimensionFilterEvalHelpers.add(BaseDimensionFilterEvalHelper.createFilterHelper(this.outResults,this.scope,defn,filter,this.session.getEngineContext().getScriptContext()));
              existLevelFilter=true;
              break;
            }
          }
          if (!existLevelFilter)           this.dimensionSimpleFilter.add(simpleLevelfilter);
        }
        break;
      }
case CubeQueryExecutor.AGGR_MEASURE_FILTER:
{
      this.aggrMeasureFilterEvalHelpers.add(new AggrMeasureFilterEvalHelper(this.outResults,scope,defn,filter,session.getEngineContext().getScriptContext()));
      break;
    }
case CubeQueryExecutor.FACTTABLE_FILTER:
default :
{
    this.advancedFacttableBasedFilterEvalHelper.add(new JSFacttableFilterEvalHelper(scope,this.session.getEngineContext().getScriptContext(),filter,this.outResults,this.defn));
  }
}
}
populateFilter=true;
}