Program: 65541
Project: 65541
Buggy source:
/** 
 * @param jsMeasureEvalFilterHelper
 * @return
 * @throws DataException 
 */
private String[] populateAggregationNames(List<String> allAggrNames,List jsMeasureEvalFilterHelper) throws DataException {
  String[] aggregationNames=new String[jsMeasureEvalFilterHelper.size()];
  for (int i=0; i < aggregationNames.length; i++) {
    IAggrMeasureFilterEvalHelper filterHelper=(IAggrMeasureFilterEvalHelper)jsMeasureEvalFilterHelper.get(i);
    List bindingName=ExpressionCompilerUtil.extractColumnExpression(filterHelper.getExpression(),ScriptConstants.DATA_BINDING_SCRIPTABLE);
    aggregationNames[i]=(String)getIntersection(allAggrNames,bindingName);
    if (aggregationNames[i] == null) {
      aggregationNames[i]=OlapExpressionCompiler.getReferencedScriptObject(filterHelper.getExpression(),ScriptConstants.DATA_SET_BINDING_SCRIPTABLE);
      if (aggregationNames[i] == null && this.executor != null) {
        List bindingList=new ArrayList();
        ICubeQueryDefinition query=this.executor.getCubeQueryDefinition();
        bindingList.addAll(query.getBindings());
        if (query instanceof PreparedCubeQueryDefinition)         bindingList.addAll(((PreparedCubeQueryDefinition)query).getBindingsForNestAggregation());
        List referencedNames=new ArrayList();
        for (int j=0; j < bindingName.size(); j++) {
          IBinding b=getBinding(bindingName.get(j).toString(),bindingList);
          if (this.fetcher != null && this.fetcher.existBinding(bindingName.get(j).toString())) {
            referencedNames.addAll(ExpressionCompilerUtil.extractColumnExpression(b.getExpression(),ScriptConstants.DATA_BINDING_SCRIPTABLE));
          }
          if (b != null && b.getAggregatOns().size() == 0 && b.getAggrFunction() == null) {
            referencedNames.addAll(ExpressionCompilerUtil.extractColumnExpression(b.getExpression(),ScriptConstants.DATA_BINDING_SCRIPTABLE));
          }
        }
        aggregationNames[i]=(String)getIntersection(allAggrNames,referencedNames);
      }
    }
  }
  return aggregationNames;
}

Fixed version (ground truth):
/** 
 * @param jsMeasureEvalFilterHelper
 * @return
 * @throws DataException 
 */
private String[] populateAggregationNames(List<String> allAggrNames,List jsMeasureEvalFilterHelper) throws DataException {
  String[] aggregationNames=new String[jsMeasureEvalFilterHelper.size()];
  for (int i=0; i < aggregationNames.length; i++) {
    IAggrMeasureFilterEvalHelper filterHelper=(IAggrMeasureFilterEvalHelper)jsMeasureEvalFilterHelper.get(i);
    List bindingName=ExpressionCompilerUtil.extractColumnExpression(filterHelper.getExpression(),ScriptConstants.DATA_BINDING_SCRIPTABLE);
    aggregationNames[i]=(String)getIntersection(allAggrNames,bindingName);
    if (aggregationNames[i] == null) {
      aggregationNames[i]=OlapExpressionCompiler.getReferencedScriptObject(filterHelper.getExpression(),ScriptConstants.DATA_SET_BINDING_SCRIPTABLE);
      if (aggregationNames[i] == null && this.executor != null) {
        List bindingList=new ArrayList();
        ICubeQueryDefinition query=this.executor.getCubeQueryDefinition();
        bindingList.addAll(query.getBindings());
        if (query instanceof PreparedCubeQueryDefinition)         bindingList.addAll(((PreparedCubeQueryDefinition)query).getBindingsForNestAggregation());
        List referencedNames=new ArrayList();
        for (int j=0; j < bindingName.size(); j++) {
          IBinding b=getBinding(bindingName.get(j).toString(),bindingList);
          if (b != null && b.getAggregatOns().size() == 0 && b.getAggrFunction() == null) {
            referencedNames.addAll(ExpressionCompilerUtil.extractColumnExpression(b.getExpression(),ScriptConstants.DATA_BINDING_SCRIPTABLE));
          }
        }
        aggregationNames[i]=(String)getIntersection(allAggrNames,referencedNames);
      }
    }
  }
  return aggregationNames;
}