nus-yam/ex-repair huggingface dataset:
Program: 66360
Project: 66360
Buggy source:
@Override public List<TimeMember> getResult(TimeMember member){
  List timeMembers=new ArrayList<TimeMember>();
  String[] levelTypes=member.getLevelType();
  int[] values=member.getMemberValue();
  Calendar cal=new GregorianCalendar();
  String baseType=translateToCal(cal,levelTypes,values);
  int[] tmp;
  if (baseType.equals(MONTH)) {
    timeMembers.add(member);
  }
 else   if (baseType.equals(WEEK)) {
    int weekOfMonth=cal.get(Calendar.WEEK_OF_MONTH);
    int month=cal.get(Calendar.MONTH);
    int year=cal.get(Calendar.YEAR);
    for (int i=1; i <= weekOfMonth; i++) {
      cal.set(Calendar.YEAR,year);
      cal.set(Calendar.MONTH,month);
      cal.set(Calendar.WEEK_OF_MONTH,i);
      tmp=getValueFromCal(cal,levelTypes);
      TimeMember timeMember=new TimeMember(tmp,levelTypes);
      timeMembers.add(timeMember);
    }
  }
 else   if (baseType.equals(DAY)) {
    int dayOfMonth=cal.get(Calendar.DAY_OF_MONTH);
    for (int i=1; i <= dayOfMonth; i++) {
      cal.set(Calendar.DAY_OF_MONTH,i);
      tmp=getValueFromCal(cal,levelTypes);
      TimeMember timeMember=new TimeMember(tmp,levelTypes);
      timeMembers.add(timeMember);
    }
  }
  return timeMembers;
}

Fixed version (ground truth):
public List<TimeMember> getResult(TimeMember member){
  List timeMembers=new ArrayList<TimeMember>();
  String[] levelTypes=member.getLevelType();
  int[] values=member.getMemberValue();
  Calendar cal=new GregorianCalendar();
  String baseType=translateToCal(cal,levelTypes,values);
  int[] tmp;
  if (baseType.equals(MONTH)) {
    timeMembers.add(member);
  }
 else   if (baseType.equals(WEEK)) {
    int weekOfMonth=cal.get(Calendar.WEEK_OF_MONTH);
    int month=cal.get(Calendar.MONTH);
    int year=cal.get(Calendar.YEAR);
    for (int i=1; i <= weekOfMonth; i++) {
      cal.set(Calendar.YEAR,year);
      cal.set(Calendar.MONTH,month);
      cal.set(Calendar.WEEK_OF_MONTH,i);
      tmp=getValueFromCal(cal,levelTypes);
      TimeMember timeMember=new TimeMember(tmp,levelTypes);
      timeMembers.add(timeMember);
    }
  }
 else   if (baseType.equals(DAY)) {
    int dayOfMonth=cal.get(Calendar.DAY_OF_MONTH);
    for (int i=1; i <= dayOfMonth; i++) {
      cal.set(Calendar.DAY_OF_MONTH,i);
      tmp=getValueFromCal(cal,levelTypes);
      TimeMember timeMember=new TimeMember(tmp,levelTypes);
      timeMembers.add(timeMember);
    }
  }
  return timeMembers;
}
Program: 66362
Project: 66362
Buggy source:
@Override public List<TimeMember> getResult(TimeMember member){
  List timeMembers=new ArrayList<TimeMember>();
  String[] levelTypes=member.getLevelType();
  int[] values=member.getMemberValue();
  Calendar cal=new GregorianCalendar();
  String baseType=translateToCal(cal,levelTypes,values);
  if (baseType.equals(WEEK)) {
    timeMembers.add(member);
  }
 else   if (baseType.equals(DAY)) {
    int weekday=cal.get(Calendar.DAY_OF_WEEK);
    int[] tmp;
    Calendar newCal=new GregorianCalendar();
    for (int i=1; i <= weekday; i++) {
      newCal.setTimeInMillis(cal.getTimeInMillis() - (weekday - i) * dayTimeInMills);
      tmp=getValueFromCal(newCal,levelTypes);
      TimeMember timeMember=new TimeMember(tmp,levelTypes);
      timeMembers.add(timeMember);
    }
  }
  return timeMembers;
}

Fixed version (ground truth):
public List<TimeMember> getResult(TimeMember member){
  List timeMembers=new ArrayList<TimeMember>();
  String[] levelTypes=member.getLevelType();
  int[] values=member.getMemberValue();
  Calendar cal=new GregorianCalendar();
  String baseType=translateToCal(cal,levelTypes,values);
  if (baseType.equals(WEEK)) {
    timeMembers.add(member);
  }
 else   if (baseType.equals(DAY)) {
    int weekday=cal.get(Calendar.DAY_OF_WEEK);
    int[] tmp;
    Calendar newCal=new GregorianCalendar();
    for (int i=1; i <= weekday; i++) {
      newCal.setTimeInMillis(cal.getTimeInMillis() - (weekday - i) * dayTimeInMills);
      tmp=getValueFromCal(newCal,levelTypes);
      TimeMember timeMember=new TimeMember(tmp,levelTypes);
      timeMembers.add(timeMember);
    }
  }
  return timeMembers;
}
Program: 66363
Project: 66363
Buggy source:
private static CalculatedMember[] extractMeasure(ICubeQueryDefinition queryDefn,Map measureMapping) throws DataException {
  List measureList=queryDefn.getMeasures();
  if (measureList == null)   return new CalculatedMember[0];
  List measureAggrOns=populateMeasureAggrOns(queryDefn);
  List unreferencedMeasures=getUnreferencedMeasures(queryDefn,measureList,measureMapping,measureAggrOns);
  CalculatedMember[] calculatedMembers1=new CalculatedMember[unreferencedMeasures.size()];
  int index=0;
  Iterator measureIter=unreferencedMeasures.iterator();
  while (measureIter.hasNext()) {
    MeasureDefinition measureDefn=(MeasureDefinition)measureIter.next();
    String innerName=OlapExpressionUtil.createMeasureCalculateMemeberName(measureDefn.getName());
    measureMapping.put(measureDefn.getName(),innerName);
    calculatedMembers1[index]=new CalculatedMember(new CubeAggrDefnOnMeasure(innerName,measureDefn.getName(),measureAggrOns,adaptAggrFunction(measureDefn),null,null),0);
    index++;
  }
  return calculatedMembers1;
}

Fixed version (ground truth):
private static CalculatedMember[] extractMeasure(ICubeQueryDefinition queryDefn,Map measureMapping) throws DataException {
  List measureList=queryDefn.getMeasures();
  if (measureList == null)   return new CalculatedMember[0];
  List measureAggrOns=populateMeasureAggrOns(queryDefn);
  List unreferencedMeasures=getUnreferencedMeasures(queryDefn,measureList,measureMapping,measureAggrOns);
  CalculatedMember[] calculatedMembers1=new CalculatedMember[unreferencedMeasures.size()];
  int index=0;
  Iterator measureIter=unreferencedMeasures.iterator();
  while (measureIter.hasNext()) {
    MeasureDefinition measureDefn=(MeasureDefinition)measureIter.next();
    String innerName=OlapExpressionUtil.createMeasureCalculateMemeberName(measureDefn.getName());
    measureMapping.put(measureDefn.getName(),innerName);
    calculatedMembers1[index]=new CalculatedMember(new CubeAggrDefnOnMeasure(innerName,measureDefn.getName(),measureAggrOns,adaptAggrFunction(measureDefn),null,null,null),0);
    index++;
  }
  return calculatedMembers1;
}
Program: 66364
Project: 66364
Buggy source:
public CubeNestAggrDefn(String name,IBaseExpression basedExpression,List aggrLevels,String aggrName,List arguments,IBaseExpression filterExpression){
  super(name,aggrLevels,aggrName,arguments,filterExpression);
  this.basedExpression=basedExpression;
}

Fixed version (ground truth):
public CubeNestAggrDefn(String name,IBaseExpression basedExpression,List aggrLevels,String aggrName,List arguments,IBaseExpression filterExpression){
  super(name,aggrLevels,aggrName,null,arguments,filterExpression);
  this.basedExpression=basedExpression;
}
Program: 66365
Project: 66365
Buggy source:
private ITimeFunction adaptTimeFunction(ComputedColumnHandle handle){
  TimeFunction timeFunction=new TimeFunction();
  IBaseExpression sciptExpr=this.adaptExpression((Expression)handle.getReferenceDate().getExpression());
  Object referenceDate=ScriptEvalUtil.evalExpr(sciptExpr,this.context.getDataEngineContext().getScriptContext(),"String_Node_Str",0);
  timeFunction.setReferenceDate(new ReferenceDate(DataTypeUtil.toDate(referenceDate)));
  timeFunction.setTimeDimension(handle.getTimeDimension().getStringValue());
  timeFunction.setBaseTimePeriod(populateTimePeriod(handle.getBaseTimePeriod()));
  timeFunction.setRelativeTimePeriod(populateTimePeriod(handle.getOffset()));
  return timeFunction;
}

Fixed version (ground truth):
private ITimeFunction adaptTimeFunction(ComputedColumnHandle handle) throws DataException, BirtException {
  TimeFunction timeFunction=new TimeFunction();
  IBaseExpression sciptExpr=this.adaptExpression((Expression)handle.getReferenceDate().getExpression());
  Object referenceDate=ScriptEvalUtil.evalExpr(sciptExpr,this.context.getDataEngineContext().getScriptContext(),"String_Node_Str",0);
  timeFunction.setReferenceDate(new ReferenceDate(DataTypeUtil.toDate(referenceDate)));
  timeFunction.setTimeDimension(handle.getTimeDimension().getStringValue());
  timeFunction.setBaseTimePeriod(populateTimePeriod(handle.getBaseTimePeriod()));
  timeFunction.setRelativeTimePeriod(populateTimePeriod(handle.getOffset()));
  return timeFunction;
}
Program: 66366
Project: 66366
Buggy source:
private ITimePeriod populateTimePeriod(TimePeriodHandle periodHandle){
  String periodType=periodHandle.getTimePeriodType();
  ITimePeriod period;
  if (DesignChoiceConstants.INTERVAL_YEAR.equals(periodType)) {
    period=new TimePeriod(baseTimePeriod.getNumberOfUnit(),TimePeriodType.YEAR);
  }
 else   if (DesignChoiceConstants.INTERVAL_QUARTER.equals(periodType)) {
    period=new TimePeriod(baseTimePeriod.getNumberOfUnit(),TimePeriodType.QUARTER);
  }
 else   if (DesignChoiceConstants.INTERVAL_MONTH.equals(periodType)) {
    period=new TimePeriod(baseTimePeriod.getNumberOfUnit(),TimePeriodType.MONTH);
  }
 else   if (DesignChoiceConstants.INTERVAL_WEEK.equals(periodType)) {
    period=new TimePeriod(baseTimePeriod.getNumberOfUnit(),TimePeriodType.WEEK);
  }
 else   if (DesignChoiceConstants.INTERVAL_DAY.equals(periodType)) {
    period=new TimePeriod(baseTimePeriod.getNumberOfUnit(),TimePeriodType.DAY);
  }
  return period;
}

Fixed version (ground truth):
private ITimePeriod populateTimePeriod(TimePeriodHandle periodHandle){
  String periodType=periodHandle.getTimePeriodType();
  ITimePeriod period=null;
  if (DesignChoiceConstants.INTERVAL_YEAR.equals(periodType)) {
    period=new TimePeriod(periodHandle.getNumberOfUnit(),TimePeriodType.YEAR);
  }
 else   if (DesignChoiceConstants.INTERVAL_QUARTER.equals(periodType)) {
    period=new TimePeriod(periodHandle.getNumberOfUnit(),TimePeriodType.QUARTER);
  }
 else   if (DesignChoiceConstants.INTERVAL_MONTH.equals(periodType)) {
    period=new TimePeriod(periodHandle.getNumberOfUnit(),TimePeriodType.MONTH);
  }
 else   if (DesignChoiceConstants.INTERVAL_WEEK.equals(periodType)) {
    period=new TimePeriod(periodHandle.getNumberOfUnit(),TimePeriodType.WEEK);
  }
 else   if (DesignChoiceConstants.INTERVAL_DAY.equals(periodType)) {
    period=new TimePeriod(periodHandle.getNumberOfUnit(),TimePeriodType.DAY);
  }
  return period;
}
Program: 66367
Project: 66367
Buggy source:
private void doCalculate(int functionIndex) throws DataException {
  for (int i=0; i < currentRowList.size(); i++) {
    if (!getFilterResult(currentRowList.get(i),functionIndex))     continue;
    while (currentRowList.get(i).nextMeasures()) {
      Object[] para=getAccumulatorParameter(currentRowList.get(i),functionIndex);
      for (int j=0; j < currentFilterList[functionIndex].size(); j++) {
        this.accumulators[currentFilterList[functionIndex].get(j).cellPosition][functionIndex].onRow(para);
      }
    }
  }
}

Fixed version (ground truth):
private void doCalculate(int functionIndex) throws DataException {
  for (int i=0; i < currentRowList.size(); i++) {
    if (!getFilterResult(currentRowList.get(i),functionIndex))     continue;
    while (currentRowList.get(i).nextMeasures()) {
      Object[] para=getAccumulatorParameter(currentRowList.get(i),functionIndex);
      for (int j=0; j < currentFilterList[functionIndex].size(); j++) {
        this.accumulators[currentFilterList[functionIndex].get(j).cellPosition][functionIndex].onRow(para);
      }
    }
    currentRowList.get(i).firstMeasure();
  }
}
Program: 66368
Project: 66368
Buggy source:
/** 
 * Returns the fill from palette. If the index is less than the palette colors size, simply return the fill. If else, first return brighter fill, then darker fill. The color fetching logic is like this: In the first round, use the color from palette directly. In the second round, use the brighter color of respective one in the first round. In the third round, use the darker color of respective one in the first round. In the forth round, use the brighter color of respective one in the second round. In the fifth round, use the darker color of respective one in the third round. ...
 * @param elPalette
 * @param index
 * @since 2.5
 * @return fill from palette
 */
public static Fill getPaletteFill(EList<Fill> elPalette,int index){
  final int iPaletteSize=elPalette.size();
  Fill fill=elPalette.get(index % iPaletteSize);
  if (index < iPaletteSize) {
    return goFactory.copyOf(fill);
  }
  if (fill instanceof ColorDefinition) {
    return tunePaletteColor((ColorDefinition)fill,iPaletteSize,index);
  }
  int d=index / iPaletteSize;
  if (d % 2 != 0) {
    Fill brighterFill=getBrighterFill(fill);
    while (d / 2 > 0) {
      d-=2;
      brighterFill=getBrighterFill(brighterFill);
    }
    return brighterFill;
  }
  Fill darkerFill=getDarkerFill(fill);
  while ((d - 1) / 2 > 0) {
    d-=2;
    darkerFill=getDarkerFill(darkerFill);
  }
  return darkerFill;
}

Fixed version (ground truth):
/** 
 * Returns the fill from palette. If the index is less than the palette colors size, simply return the fill. If else, first return brighter fill, then darker fill. The color fetching logic is like this: In the first round, use the color from palette directly. In the second round, use the brighter color of respective one in the first round. In the third round, use the darker color of respective one in the first round. In the forth round, use the brighter color of respective one in the second round. In the fifth round, use the darker color of respective one in the third round. ...
 * @param elPalette
 * @param index
 * @since 2.5
 * @return fill from palette
 */
public static Fill getPaletteFill(EList<Fill> elPalette,int index){
  final int iPaletteSize=elPalette.size();
  if (iPaletteSize == 0) {
    return null;
  }
  Fill fill=elPalette.get(index % iPaletteSize);
  if (index < iPaletteSize) {
    return goFactory.copyOf(fill);
  }
  if (fill instanceof ColorDefinition) {
    return tunePaletteColor((ColorDefinition)fill,iPaletteSize,index);
  }
  int d=index / iPaletteSize;
  if (d % 2 != 0) {
    Fill brighterFill=getBrighterFill(fill);
    while (d / 2 > 0) {
      d-=2;
      brighterFill=getBrighterFill(brighterFill);
    }
    return brighterFill;
  }
  Fill darkerFill=getDarkerFill(fill);
  while ((d - 1) / 2 > 0) {
    d-=2;
    darkerFill=getDarkerFill(darkerFill);
  }
  return darkerFill;
}
Program: 66369
Project: 66369
Buggy source:
/** 
 * Only for non-collection object
 * @param ob1
 * @param ob2
 * @return
 */
private static boolean isEqualObject(Object ob1,Object ob2){
  if (ob1 == ob2)   return true;
 else   if (ob1 == null || ob2 == null)   return false;
  return ob1.equals(ob2);
}

Fixed version (ground truth):
/** 
 * Only for non-collection object
 * @param ob1
 * @param ob2
 * @return
 */
public static boolean isEqualObject(Object ob1,Object ob2){
  if (ob1 == ob2)   return true;
 else   if (ob1 == null || ob2 == null)   return false;
  return ob1.equals(ob2);
}
Program: 66370
Project: 66370
Buggy source:
/** 
 * @param row
 * @throws IOException
 * @throws DataException
 */
void onRow(Row4Aggregation row) throws IOException, DataException {
  if (currentResultObj == null) {
    newAggregationResultRow(row);
  }
 else {
    if (currentResultObj.getLevelMembers() == null || compare(row.getLevelMembers(),currentResultObj.getLevelMembers()) == 0) {
      if (accumulators != null) {
        for (int i=0; i < accumulators.length; i++) {
          if (!getFilterResult(row,i)) {
            continue;
          }
          accumulators[i].onRow(getAccumulatorParameter(row,i));
        }
      }
    }
 else {
      if (accumulators != null) {
        currentResultObj.setAggregationValues(new Object[accumulators.length]);
        for (int i=0; i < accumulators.length; i++) {
          accumulators[i].finish();
          currentResultObj.getAggregationValues()[i]=accumulators[i].getValue();
          accumulators[i].start();
        }
      }
      result.add(currentResultObj);
      newAggregationResultRow(row);
    }
  }
}

Fixed version (ground truth):
/** 
 * @param row
 * @throws IOException
 * @throws DataException
 */
void onRow(Row4Aggregation row) throws IOException, DataException {
  if (currentResultObj == null) {
    newAggregationResultRow(row);
  }
 else {
    if (currentResultObj.getLevelMembers() == null || compare(row.getLevelMembers(),currentResultObj.getLevelMembers()) == 0) {
      if (accumulators != null) {
        while (row.nextMeasures()) {
          for (int i=0; i < accumulators.length; i++) {
            if (!getFilterResult(row,i)) {
              continue;
            }
            accumulators[i].onRow(getAccumulatorParameter(row,i));
          }
        }
        row.firstMeasure();
      }
    }
 else {
      if (accumulators != null) {
        currentResultObj.setAggregationValues(new Object[accumulators.length]);
        for (int i=0; i < accumulators.length; i++) {
          accumulators[i].finish();
          currentResultObj.getAggregationValues()[i]=accumulators[i].getValue();
          accumulators[i].start();
        }
      }
      result.add(currentResultObj);
      newAggregationResultRow(row);
    }
  }
}
Program: 66371
Project: 66371
Buggy source:
/** 
 * @param row
 * @throws DataException
 * @throws IOException 
 */
private void newAggregationResultRow(Row4Aggregation row) throws DataException, IOException {
  currentResultObj=new AggregationResultRow();
  if (levelCount > 0) {
    currentResultObj.setLevelMembers(new Member[levelCount]);
    System.arraycopy(row.getLevelMembers(),0,currentResultObj.getLevelMembers(),0,currentResultObj.getLevelMembers().length);
  }
  if (accumulators != null) {
    for (int i=0; i < accumulators.length; i++) {
      if (!getFilterResult(row,i)) {
        continue;
      }
      accumulators[i].onRow(getAccumulatorParameter(row,i));
    }
  }
}

Fixed version (ground truth):
/** 
 * @param row
 * @throws DataException
 * @throws IOException 
 */
private void newAggregationResultRow(Row4Aggregation row) throws DataException, IOException {
  currentResultObj=new AggregationResultRow();
  if (levelCount > 0) {
    currentResultObj.setLevelMembers(new Member[levelCount]);
    System.arraycopy(row.getLevelMembers(),0,currentResultObj.getLevelMembers(),0,currentResultObj.getLevelMembers().length);
  }
  if (accumulators != null) {
    while (row.nextMeasures()) {
      for (int i=0; i < accumulators.length; i++) {
        if (!getFilterResult(row,i)) {
          continue;
        }
        accumulators[i].onRow(getAccumulatorParameter(row,i));
      }
    }
    row.firstMeasure();
  }
}
Program: 66377
Project: 66377
Buggy source:
/** 
 * @param shellParent dialog shell
 * @param formatspecifier format model
 * @param sTitle this argument is obsolete
 * @param axisTypes Axis types to indicate supported data types. Null means all types are supported.
 * @since 2.2
 */
public FormatSpecifierDialog(Shell shellParent,FormatSpecifier formatspecifier,AxisType[] axisTypes,String sTitle){
  this(shellParent,formatspecifier,sTitle);
  this.axisTypes=axisTypes;
}

Fixed version (ground truth):
/** 
 * @param shellParent dialog shell
 * @param formatspecifier format model
 * @param sTitle this argument is obsolete
 * @param axisTypes Axis types to indicate supported data types. Null means all types are supported.
 * @since 2.2
 */
public FormatSpecifierDialog(Shell shellParent,FormatSpecifier formatspecifier,AxisType[] axisTypes,String sTitle){
  this(shellParent,formatspecifier,sTitle);
  if (axisTypes != null && axisTypes.length == 1 && axisTypes[0] == null) {
    this.axisTypes=null;
  }
 else {
    this.axisTypes=axisTypes;
  }
}
Program: 66378
Project: 66378
Buggy source:
protected void handleFormatBtnSelected(){
  String sAxisTitle=Messages.getString("String_Node_Str");
  try {
    String sTitleString=getAxisForProcessing().getTitle().getCaption().getValue();
    int iSeparatorIndex=sTitleString.indexOf(ExternalizedTextEditorComposite.SEPARATOR);
    if (iSeparatorIndex > 0) {
      sTitleString=sTitleString.substring(iSeparatorIndex);
    }
 else     if (iSeparatorIndex == 0) {
      sTitleString=sTitleString.substring(ExternalizedTextEditorComposite.SEPARATOR.length());
    }
    sAxisTitle+="String_Node_Str" + sTitleString + "String_Node_Str";
  }
 catch (  NullPointerException e1) {
  }
  FormatSpecifier formatspecifier=null;
  if (getAxisForProcessing().getFormatSpecifier() != null) {
    formatspecifier=getAxisForProcessing().getFormatSpecifier();
  }
  FormatSpecifierDialog editor=new FormatSpecifierDialog(cmpContent.getShell(),formatspecifier,getAxisForProcessing().getType(),sAxisTitle);
  if (editor.open() == Window.OK) {
    if (editor.getFormatSpecifier() == null) {
      getAxisForProcessing().eUnset(ComponentPackage.eINSTANCE.getAxis_FormatSpecifier());
    }
 else {
      getAxisForProcessing().setFormatSpecifier(editor.getFormatSpecifier());
    }
  }
}

Fixed version (ground truth):
protected void handleFormatBtnSelected(){
  String sAxisTitle=Messages.getString("String_Node_Str");
  try {
    String sTitleString=getAxisForProcessing().getTitle().getCaption().getValue();
    int iSeparatorIndex=sTitleString.indexOf(ExternalizedTextEditorComposite.SEPARATOR);
    if (iSeparatorIndex > 0) {
      sTitleString=sTitleString.substring(iSeparatorIndex);
    }
 else     if (iSeparatorIndex == 0) {
      sTitleString=sTitleString.substring(ExternalizedTextEditorComposite.SEPARATOR.length());
    }
    sAxisTitle+="String_Node_Str" + sTitleString + "String_Node_Str";
  }
 catch (  NullPointerException e1) {
  }
  FormatSpecifier formatspecifier=null;
  if (getAxisForProcessing().getFormatSpecifier() != null) {
    formatspecifier=getAxisForProcessing().getFormatSpecifier();
  }
  getContext().getUIServiceProvider().getFormatSpecifierHandler().handleFormatSpecifier(cmpContent.getShell(),sAxisTitle,new AxisType[]{getAxisForProcessing().getType()},formatspecifier,getAxisForProcessing(),"String_Node_Str",getContext());
}
Program: 66381
Project: 66381
Buggy source:
private static AggregationFunctionDefinition getFunctionName(AggregationDefinition[] aggregations) throws DataException {
  AggregationFunctionDefinition func=null;
  for (int i=0; i < aggregations.length; i++) {
    AggregationFunctionDefinition[] aggrFunc=aggregations[i].getAggregationFunctions();
    if (aggrFunc == null)     continue;
    for (int j=0; j < aggrFunc.length; j++) {
      if (func == null && aggrFunc[j].getFilterEvalHelper() == null) {
        func=aggrFunc[j];
      }
 else {
        if (func != null && !equal(func,aggrFunc[j]))         return null;
      }
    }
  }
  if (func != null && isSimepleFunction(func.getFunctionName()) && func.getTimeFunction() == null)   return func;
 else   return null;
}

Fixed version (ground truth):
private AggregationFunctionDefinition getFunctionName(AggregationDefinition[] aggregations) throws DataException {
  AggregationFunctionDefinition func=null;
  for (int i=0; i < aggregations.length; i++) {
    AggregationFunctionDefinition[] aggrFunc=aggregations[i].getAggregationFunctions();
    if (aggrFunc == null)     continue;
    for (int j=0; j < aggrFunc.length; j++) {
      if (func == null && aggrFunc[j].getFilterEvalHelper() == null) {
        func=aggrFunc[j];
      }
 else {
        if (func != null && !equal(func,aggrFunc[j]))         return null;
      }
    }
  }
  if (func != null && isSimepleFunction(func.getFunctionName()) && existReferenceDate)   return func;
 else   return null;
}
Program: 66382
Project: 66382
Buggy source:
/** 
 * create a <code>DataEngine</code> given an execution context
 * @param context the execution context
 * @return a data engine instance
 */
public IDataEngine createDataEngine(ExecutionContext context,boolean needCache) throws Exception {
  DocumentDataSource dataSource=context.getDataSource();
  if (dataSource != null) {
    ReportDocumentWriter writer=context.getReportDocWriter();
    IDocArchiveWriter archiverWriter=null;
    if (writer != null) {
      archiverWriter=writer.getArchive();
    }
    return new DataInteractiveEngine(this,context,dataSource.getDataSource(),archiverWriter);
  }
  ReportDocumentWriter writer=context.getReportDocWriter();
  if (writer != null) {
    return new DataGenerationEngine(this,context,context.getReportDocWriter().getArchive());
  }
  IReportDocument document=context.getReportDocument();
  if (document != null) {
    if (context.getEngineTask().getTaskType() == EngineTask.TASK_DATAEXTRACTION) {
      return new DataInteractiveEngine(this,context,context.getReportDocument().getArchive(),null);
    }
    return new DataPresentationEngine(this,context,context.getReportDocument().getArchive());
  }
  return new DteDataEngine(this,context,needCache);
}

Fixed version (ground truth):
/** 
 * create a <code>DataEngine</code> given an execution context
 * @param context the execution context
 * @return a data engine instance
 */
public IDataEngine createDataEngine(ExecutionContext context,boolean needCache) throws Exception {
  DocumentDataSource dataSource=context.getDataSource();
  if (dataSource != null) {
    ReportDocumentWriter writer=context.getReportDocWriter();
    IDocArchiveWriter archiverWriter=null;
    if (writer != null) {
      archiverWriter=writer.getArchive();
    }
    return new DataInteractiveEngine(this,context,dataSource.getDataSource(),archiverWriter);
  }
  ReportDocumentWriter writer=context.getReportDocWriter();
  if (writer != null) {
    return new DataGenerationEngine(this,context,context.getReportDocWriter().getArchive());
  }
  IReportDocument document=context.getReportDocument();
  if (document != null) {
    if (context.getEngineTask().getTaskType() == EngineTask.TASK_DATAEXTRACTION) {
      return new DataInteractiveEngine(this,context,context.getReportDocument().getArchive(),null);
    }
    return new DataPresentationEngine(this,context,context.getReportDocument().getArchive(),needCache);
  }
  return new DteDataEngine(this,context,needCache);
}
Program: 66383
Project: 66383
Buggy source:
/** 
 * Prepare all default styles for various StyledComponent.
 * @param model
 * @param externalProcessor
 */
public final void prepareStyles(Chart model,IStyleProcessor externalProcessor){
  if (externalProcessor != null) {
    externalProcessor.processStyle(model);
  }
  Stack<StyledComponent> token=new Stack<StyledComponent>();
  token.push(StyledComponent.CHART_ALL_LITERAL);
  prepareComponent(model,token,model,externalProcessor);
  token.clear();
}

Fixed version (ground truth):
/** 
 * Prepare all default styles for various StyledComponent.
 * @param model
 * @param externalProcessor
 */
public final void prepareStyles(Chart model,IStyleProcessor externalProcessor){
  boolean updatedModel=false;
  if (externalProcessor != null) {
    updatedModel=externalProcessor.updateChart(model,null);
  }
  if (!updatedModel) {
    chartValueUpdater.update(model,null);
  }
  if (externalProcessor != null) {
    externalProcessor.processStyle(model);
  }
  Stack<StyledComponent> token=new Stack<StyledComponent>();
  token.push(StyledComponent.CHART_ALL_LITERAL);
  prepareComponent(model,token,model,externalProcessor);
  token.clear();
}
Program: 66384
Project: 66384
Buggy source:
@Override public void processStyle(Chart cm){
  styleProcessorProxy.updateChart(cm);
  DataSetHandle dataset=ChartItemUtil.getBindingDataSet(handle);
  if (dataset != null) {
    processDataSetStyle(cm);
    return;
  }
  CubeHandle cube=ChartCubeUtil.getBindingCube(handle);
  if (cube == null) {
    return;
  }
  final ExpressionCodec exprCodec=ChartModelHelper.instance().createExpressionCodec();
  List<Query> bsQuery=ChartUtil.getBaseSeriesDefinitions(cm).get(0).getDesignTimeSeries().getDataDefinition();
  List<SeriesDefinition> vsds=ChartUtil.getAllOrthogonalSeriesDefinitions(cm);
  SeriesDefinition vsd=vsds.isEmpty() ? null : vsds.get(0);
  LevelHandle category=bsQuery.size() == 0 ? null : findLevelHandle(cube,exprCodec,bsQuery.get(0));
  LevelHandle yoption=vsd == null ? null : findLevelHandle(cube,exprCodec,vsd.getQuery());
  Query query=null;
  if (vsd != null && vsd.getDesignTimeSeries().getDataDefinition().size() > 0) {
    query=vsd.getDesignTimeSeries().getDataDefinition().get(0);
  }
  MeasureHandle measure=findMeasureHandle(cube,exprCodec,query);
  if (category != null || measure != null || yoption != null) {
    processCubeStyle(cm,category,measure,yoption);
  }
}

Fixed version (ground truth):
@Override public void processStyle(Chart cm){
  DataSetHandle dataset=ChartItemUtil.getBindingDataSet(handle);
  if (dataset != null) {
    processDataSetStyle(cm);
    return;
  }
  CubeHandle cube=ChartCubeUtil.getBindingCube(handle);
  if (cube == null) {
    return;
  }
  final ExpressionCodec exprCodec=ChartModelHelper.instance().createExpressionCodec();
  List<Query> bsQuery=ChartUtil.getBaseSeriesDefinitions(cm).get(0).getDesignTimeSeries().getDataDefinition();
  List<SeriesDefinition> vsds=ChartUtil.getAllOrthogonalSeriesDefinitions(cm);
  SeriesDefinition vsd=vsds.isEmpty() ? null : vsds.get(0);
  LevelHandle category=bsQuery.size() == 0 ? null : findLevelHandle(cube,exprCodec,bsQuery.get(0));
  LevelHandle yoption=vsd == null ? null : findLevelHandle(cube,exprCodec,vsd.getQuery());
  Query query=null;
  if (vsd != null && vsd.getDesignTimeSeries().getDataDefinition().size() > 0) {
    query=vsd.getDesignTimeSeries().getDataDefinition().get(0);
  }
  MeasureHandle measure=findMeasureHandle(cube,exprCodec,query);
  if (category != null || measure != null || yoption != null) {
    processCubeStyle(cm,category,measure,yoption);
  }
}
Program: 66385
Project: 66385
Buggy source:
/** 
 * create a <code>DataEngine</code> given an execution context
 * @param context the execution context
 * @return a data engine instance
 */
public IDataEngine createDataEngine(ExecutionContext context,boolean needCache) throws Exception {
  DocumentDataSource dataSource=context.getDataSource();
  if (dataSource != null) {
    ReportDocumentWriter writer=context.getReportDocWriter();
    IDocArchiveWriter archiverWriter=null;
    if (writer != null) {
      archiverWriter=writer.getArchive();
    }
    return new DataInteractiveEngine(this,context,dataSource.getDataSource(),archiverWriter);
  }
  ReportDocumentWriter writer=context.getReportDocWriter();
  if (writer != null) {
    return new DataGenerationEngine(this,context,context.getReportDocWriter().getArchive());
  }
  IReportDocument document=context.getReportDocument();
  if (document != null) {
    if (context.getEngineTask().getTaskType() == EngineTask.TASK_DATAEXTRACTION) {
      return new DataInteractiveEngine(this,context,context.getReportDocument().getArchive(),null);
    }
    return new DataPresentationEngine(this,context,context.getReportDocument().getArchive());
  }
  return new DteDataEngine(this,context,needCache);
}

Fixed version (ground truth):
/** 
 * create a <code>DataEngine</code> given an execution context
 * @param context the execution context
 * @return a data engine instance
 */
public IDataEngine createDataEngine(ExecutionContext context,boolean needCache) throws Exception {
  DocumentDataSource dataSource=context.getDataSource();
  if (dataSource != null) {
    ReportDocumentWriter writer=context.getReportDocWriter();
    IDocArchiveWriter archiverWriter=null;
    if (writer != null) {
      archiverWriter=writer.getArchive();
    }
    return new DataInteractiveEngine(this,context,dataSource.getDataSource(),archiverWriter);
  }
  ReportDocumentWriter writer=context.getReportDocWriter();
  if (writer != null) {
    return new DataGenerationEngine(this,context,context.getReportDocWriter().getArchive());
  }
  IReportDocument document=context.getReportDocument();
  if (document != null) {
    if (context.getEngineTask().getTaskType() == EngineTask.TASK_DATAEXTRACTION) {
      return new DataInteractiveEngine(this,context,context.getReportDocument().getArchive(),null);
    }
    return new DataPresentationEngine(this,context,context.getReportDocument().getArchive(),needCache);
  }
  return new DteDataEngine(this,context,needCache);
}
Program: 66386
Project: 66386
Buggy source:
public DataPresentationEngine(DataEngineFactory factory,ExecutionContext context,IDocArchiveReader reader) throws Exception {
  super(factory,context);
  DataSessionContext dteSessionContext=new DataSessionContext(DataSessionContext.MODE_PRESENTATION,null,context.getScriptContext(),context.getApplicationClassLoader());
  dteSessionContext.setDocumentReader(reader);
  dteSessionContext.setAppContext(context.getAppContext());
  DataEngineContext dteEngineContext=dteSessionContext.getDataEngineContext();
  dteEngineContext.setLocale(context.getLocale());
  dteEngineContext.setTimeZone(context.getTimeZone());
  String tempDir=getTempDir(context);
  if (tempDir != null) {
    dteEngineContext.setTmpdir(tempDir);
  }
  dteSession=DataRequestSession.newSession(dteSessionContext);
  loadDteMetaInfo(reader);
}

Fixed version (ground truth):
public DataPresentationEngine(DataEngineFactory factory,ExecutionContext context,IDocArchiveReader reader,boolean needAccessFactTable) throws Exception {
  super(factory,context);
  DataSessionContext dteSessionContext=new DataSessionContext(DataSessionContext.MODE_PRESENTATION,null,context.getScriptContext(),context.getApplicationClassLoader());
  dteSessionContext.setDocumentReader(reader);
  dteSessionContext.setAppContext(context.getAppContext());
  DataEngineContext dteEngineContext=dteSessionContext.getDataEngineContext();
  dteEngineContext.setLocale(context.getLocale());
  dteEngineContext.setTimeZone(context.getTimeZone());
  String tempDir=getTempDir(context);
  if (tempDir != null) {
    dteEngineContext.setTmpdir(tempDir);
  }
  dteSession=DataRequestSession.newSession(dteSessionContext);
  loadDteMetaInfo(reader);
  this.needAccessFactTable=needAccessFactTable;
}
Program: 66387
Project: 66387
Buggy source:
protected IBaseResultSet doExecuteCube(IBaseResultSet parentResult,ICubeQueryDefinition query,Object queryOwner,boolean useCache) throws BirtException {
  String queryID=(String)queryIDMap.get(query);
  String resultSetID=loadResultSetID(parentResult,queryID);
  IBaseQueryResults queryResults=null;
  query.setQueryResultsID(resultSetID);
  IBasePreparedQuery pQuery=dteSession.prepare(query,context.getAppContext());
  ScriptContext scriptContext=context.getScriptContext();
  if (parentResult != null) {
    queryResults=dteSession.execute(pQuery,parentResult.getQueryResults(),scriptContext);
  }
 else {
    queryResults=dteSession.execute(pQuery,null,scriptContext);
  }
  CubeResultSet resultSet=null;
  if (parentResult == null) {
    resultSet=new CubeResultSet(this,context,query,(ICubeQueryResults)queryResults);
  }
 else {
    resultSet=new CubeResultSet(this,context,parentResult,query,(ICubeQueryResults)queryResults);
  }
  return resultSet;
}

Fixed version (ground truth):
protected IBaseResultSet doExecuteCube(IBaseResultSet parentResult,ICubeQueryDefinition query,Object queryOwner,boolean useCache) throws BirtException {
  String queryID=(String)queryIDMap.get(query);
  String resultSetID=loadResultSetID(parentResult,queryID);
  IBaseQueryResults queryResults=null;
  query.setQueryResultsID(resultSetID);
  IBasePreparedQuery pQuery=dteSession.prepare(query,context.getAppContext());
  query.setNeedAccessFactTable(needAccessFactTable);
  ScriptContext scriptContext=context.getScriptContext();
  if (parentResult != null) {
    queryResults=dteSession.execute(pQuery,parentResult.getQueryResults(),scriptContext);
  }
 else {
    queryResults=dteSession.execute(pQuery,null,scriptContext);
  }
  CubeResultSet resultSet=null;
  if (parentResult == null) {
    resultSet=new CubeResultSet(this,context,query,(ICubeQueryResults)queryResults);
  }
 else {
    resultSet=new CubeResultSet(this,context,parentResult,query,(ICubeQueryResults)queryResults);
  }
  return resultSet;
}
Program: 66388
Project: 66388
Buggy source:
private IDataEngine getDataEngine(Report report,String archivePath,String archiveMetaName,int mode) throws Exception {
  ExecutionContext context=new ExecutionContext();
  if (mode == MODE_GENERATION) {
    archWriter=new FileArchiveWriter(archivePath);
    archWriter.initialize();
    DataGenerationEngine dataGenEngine=new DataGenerationEngine(null,context,archWriter);
    dataGenEngine.prepare(report,null);
    return dataGenEngine;
  }
 else   if (mode == MODE_PRESENTATION) {
    archReader=new FileArchiveReader(archivePath);
    archReader.open();
    DataPresentationEngine dataPresEngine=new DataPresentationEngine(null,context,archReader);
    dataPresEngine.prepare(report,null);
    return dataPresEngine;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
private IDataEngine getDataEngine(Report report,String archivePath,String archiveMetaName,int mode) throws Exception {
  ExecutionContext context=new ExecutionContext();
  if (mode == MODE_GENERATION) {
    archWriter=new FileArchiveWriter(archivePath);
    archWriter.initialize();
    DataGenerationEngine dataGenEngine=new DataGenerationEngine(null,context,archWriter);
    dataGenEngine.prepare(report,null);
    return dataGenEngine;
  }
 else   if (mode == MODE_PRESENTATION) {
    archReader=new FileArchiveReader(archivePath);
    archReader.open();
    DataPresentationEngine dataPresEngine=new DataPresentationEngine(null,context,archReader,false);
    dataPresEngine.prepare(report,null);
    return dataPresEngine;
  }
 else {
    return null;
  }
}
Program: 66389
Project: 66389
Buggy source:
protected void updatePageContent() throws BirtException {
  if (page != null) {
    IPageContent pc=(IPageContent)page.getContent();
    pc.setPageNumber(context.getPageNumber());
    if (context.needLayoutPageContent()) {
      IPageContent pageContent=ReportExecutorUtil.executeMasterPage(context.getReportExecutor(),context.getPageNumber(),(MasterPageDesign)pc.getGenerateBy());
      page.content=pageContent;
    }
  }
}

Fixed version (ground truth):
protected void updatePageContent() throws BirtException {
  if (page != null) {
    IPageContent pc=(IPageContent)page.getContent();
    pc.setPageNumber(context.getPageNumber());
    if (context.needLayoutPageContent()) {
      IPageContent pageContent=ReportExecutorUtil.executeMasterPage(context.getReportExecutor(),context.getPageNumber(),(MasterPageDesign)pc.getGenerateBy());
      context.getPageLM().layoutPageContent(pageContent);
      page.content=pageContent;
    }
  }
}
Program: 66390
Project: 66390
Buggy source:
public ReportRunnable cloneRunnable(){
  ReportDesignHandle newDesign=(ReportDesignHandle)designHandle.copy().getHandle(null);
  newDesign.setFileName(getReportName());
  ReportRunnable newRunnable=new ReportRunnable(engine,newDesign);
  newRunnable.setReportName(reportName);
  newRunnable.setPrepared(prepared);
  return newRunnable;
}

Fixed version (ground truth):
public ReportRunnable cloneRunnable(){
  Map options=((ReportDesignHandle)designHandle).getOptions();
  ReportDesignHandle newDesign=(ReportDesignHandle)designHandle.copy().getHandle(null);
  newDesign.setOptions(options);
  newDesign.setFileName(getReportName());
  ReportRunnable newRunnable=new ReportRunnable(engine,newDesign);
  newRunnable.setReportName(reportName);
  newRunnable.setPrepared(prepared);
  return newRunnable;
}
Program: 66391
Project: 66391
Buggy source:
/** 
 * @param dataEngine
 * @param queryDefns
 * @throws DataException
 */
void populateCachedDataSets(DataEngineImpl dataEngine,IDataQueryDefinition[] qds) throws DataException {
  if (qds != null) {
    queryDefns.addAll(Arrays.asList(qds));
    List temp=new ArrayList();
    for (    IDataQueryDefinition query : queryDefns) {
      if (query instanceof IQueryDefinition) {
        IQueryDefinition qd=(IQueryDefinition)query;
        String dataSetName=qd.getDataSetName();
        if (dataSetName != null) {
          IBaseDataSetDesign design=dataEngine.getDataSetDesign(dataSetName);
          if (design instanceof ICacheable)           this.populateDataSetNames(dataEngine.getDataSetDesign(dataSetName),dataEngine,temp);
        }
      }
    }
    this.cachedDataSetNames.clear();
    Set tempSet=new HashSet();
    for (int i=0; i < temp.size(); i++) {
      if (tempSet.contains(temp.get(i)))       this.cachedDataSetNames.add(temp.get(i));
 else       tempSet.add(temp.get(i));
    }
  }
}

Fixed version (ground truth):
/** 
 * @param dataEngine
 * @param queryDefns
 * @throws DataException
 */
void populateCachedDataSets(DataEngineImpl dataEngine,IDataQueryDefinition[] qds) throws DataException {
  if (qds != null) {
    queryDefns.addAll(Arrays.asList(qds));
    List temp=new ArrayList();
    List temp2=new ArrayList();
    this.cachedDataSetNames.clear();
    for (    IDataQueryDefinition query : queryDefns) {
      if (query instanceof IQueryDefinition) {
        IQueryDefinition qd=(IQueryDefinition)query;
        String dataSetName=qd.getDataSetName();
        if (dataSetName != null) {
          IBaseDataSetDesign design=dataEngine.getDataSetDesign(dataSetName);
          if (design instanceof ICacheable)           this.populateDataSetNames(dataEngine.getDataSetDesign(dataSetName),dataEngine,temp2);
          if (qd.getParentQuery() != null && qd.getInputParamBindings().size() == 0) {
            for (int i=0; i < temp2.size(); i++) {
              this.cachedDataSetNames.add(temp2.get(i));
            }
          }
          temp.addAll(temp2);
        }
      }
    }
    Set tempSet=new HashSet();
    for (int i=0; i < temp.size(); i++) {
      if (tempSet.contains(temp.get(i)))       this.cachedDataSetNames.add(temp.get(i));
 else       tempSet.add(temp.get(i));
    }
  }
}
Program: 66394
Project: 66394
Buggy source:
/** 
 * @throws DataException
 */
private void binaryMove() throws DataException {
  List<GroupInfo> groupList=this.getGroups()[groups.length - 1];
  int low=leafGroupIdx;
  if (groupList.size() == Integer.MAX_VALUE) {
    int i=0;
    while (true) {
      if (groupList.get(i).firstChild > cacheProvider.getCurrentIndex()) {
        this.leafGroupIdx=i - 1;
        return;
      }
      i++;
    }
  }
  int high=groupList.size() - 1;
  int mid;
  while (low <= high) {
    mid=(high + low) / 2;
    if (((GroupInfo)groupList.get(mid)).firstChild > cacheProvider.getCurrentIndex()) {
      high=mid - 1;
    }
 else     if (mid == groupList.size() - 1 || ((GroupInfo)groupList.get(mid + 1)).firstChild > cacheProvider.getCurrentIndex()) {
      leafGroupIdx=mid;
      return;
    }
 else {
      low=mid + 1;
    }
  }
}

Fixed version (ground truth):
/** 
 * @throws DataException
 */
private void binaryMove() throws DataException {
  List<GroupInfo> groupList=this.getGroups()[groups.length - 1];
  int low=leafGroupIdx;
  if (groupList.size() == Integer.MAX_VALUE) {
    int i=0;
    while (true) {
      GroupInfo info=groupList.get(i);
      if (info == null)       return;
      if (info.firstChild > cacheProvider.getCurrentIndex()) {
        this.leafGroupIdx=i - 1;
        return;
      }
      i++;
    }
  }
  int high=groupList.size() - 1;
  int mid;
  while (low <= high) {
    mid=(high + low) / 2;
    if (((GroupInfo)groupList.get(mid)).firstChild > cacheProvider.getCurrentIndex()) {
      high=mid - 1;
    }
 else     if (mid == groupList.size() - 1 || ((GroupInfo)groupList.get(mid + 1)).firstChild > cacheProvider.getCurrentIndex()) {
      leafGroupIdx=mid;
      return;
    }
 else {
      low=mid + 1;
    }
  }
}
Program: 66397
Project: 66397
Buggy source:
public GroupInfo get(int index){
  GroupInfo groupInfo=new GroupInfo();
  try {
    this.dataSource.seek((index * 2 + 1) * IOUtil.INT_LENGTH + this.initOffset);
    groupInfo.parent=IOUtil.readInt(this.dataSource);
    groupInfo.firstChild=IOUtil.readInt(this.dataSource);
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
  return groupInfo;
}

Fixed version (ground truth):
public GroupInfo get(int index){
  GroupInfo groupInfo=new GroupInfo();
  try {
    this.dataSource.seek((index * 2 + 1) * IOUtil.INT_LENGTH + this.initOffset);
    groupInfo.parent=IOUtil.readInt(this.dataSource);
    groupInfo.firstChild=IOUtil.readInt(this.dataSource);
  }
 catch (  IOException e) {
    try {
      if (this.dataSource.length() == ((index * 2 + 1) * IOUtil.INT_LENGTH + this.initOffset)) {
        return null;
      }
    }
 catch (    IOException e1) {
    }
    throw new RuntimeException(e);
  }
  return groupInfo;
}
Program: 66398
Project: 66398
Buggy source:
public Object getObject(String arg0) throws OLAPException {
  if (this.resultSet == null || this.resultSet.getMeasureResult() == null)   return null;
  try {
    int id=this.view.getAggregationRegisterTable().getAggregationResultID(arg0);
    int index=this.view.getAggregationRegisterTable().getAggregationIndex(id,arg0);
    if (synchronizedWithEdge(id,arg0,getCurrentValueOnEdge(arg0)))     return this.resultSet.getMeasureResult()[id].getQueryResultSet().getAggregationValue(index);
 else {
      return null;
    }
  }
 catch (  IOException e) {
    throw new OLAPException(e.getLocalizedMessage());
  }
catch (  DataException e) {
    throw new OLAPException(e.getLocalizedMessage());
  }
}

Fixed version (ground truth):
public Object getObject(String arg0) throws OLAPException {
  if (this.resultSet == null || this.resultSet.getMeasureResult() == null)   return null;
  try {
    int index=0, aggrIndex=0;
    IAggregationResultSet rs=null;
    if (aggregationResultSetIDMap.containsKey(arg0)) {
      index=aggregationResultSetIDMap.get(arg0).intValue();
      rs=this.resultSet.getMeasureResult()[index].getQueryResultSet();
      aggrIndex=rs.getAggregationIndex(arg0);
    }
 else {
      IEdgeAxis[] axis=this.resultSet.getMeasureResult();
      for (; index < axis.length; index++) {
        aggrIndex=axis[index].getQueryResultSet().getAggregationIndex(arg0);
        if (aggrIndex >= 0) {
          rs=axis[index].getQueryResultSet();
          aggregationResultSetIDMap.put(arg0,Integer.valueOf(index));
          break;
        }
      }
    }
    if (synchronizedWithEdge(index,rs,arg0,getCurrentValueOnEdge(arg0)))     return rs.getAggregationValue(aggrIndex);
 else {
      return null;
    }
  }
 catch (  IOException e) {
    throw new OLAPException(e.getLocalizedMessage());
  }
catch (  DataException e) {
    throw new OLAPException(e.getLocalizedMessage());
  }
}
Program: 66399
Project: 66399
Buggy source:
/** 
 * @param view
 * @param result
 * @param relationMap
 * @param manager
 */
public AggregationAccessor(BirtCubeView view,IResultSet result,Map relationMap){
  this.resultSet=result;
  this.view=view;
  this.relationMap=relationMap;
  this.dimensionPrepared=false;
  this.dimensionCursorMap=new HashMap();
  if (result == null || result.getMeasureResult() == null)   return;
  this.currentPosition=new int[this.resultSet.getMeasureResult().length];
  for (int i=0; i < this.resultSet.getMeasureResult().length; i++) {
    try {
      if (this.resultSet.getMeasureResult()[i].getQueryResultSet().length() > 0) {
        this.resultSet.getMeasureResult()[i].getQueryResultSet().seek(0);
        currentPosition[i]=0;
      }
 else {
        currentPosition[i]=-1;
      }
    }
 catch (    IOException e) {
    }
  }
  initMeasureNavigator();
}

Fixed version (ground truth):
/** 
 * @param view
 * @param result
 * @param relationMap
 * @param manager
 */
public AggregationAccessor(BirtCubeView view,IResultSet result,Map relationMap){
  this.resultSet=result;
  this.view=view;
  this.relationMap=relationMap;
  this.dimensionPrepared=false;
  this.dimensionCursorMap=new HashMap();
  this.aggregationResultSetIDMap=new HashMap<String,Integer>();
  if (result == null || result.getMeasureResult() == null)   return;
  this.currentPosition=new int[this.resultSet.getMeasureResult().length];
  for (int i=0; i < this.resultSet.getMeasureResult().length; i++) {
    try {
      if (this.resultSet.getMeasureResult()[i].getQueryResultSet().length() > 0) {
        this.resultSet.getMeasureResult()[i].getQueryResultSet().seek(0);
        currentPosition[i]=0;
      }
 else {
        currentPosition[i]=-1;
      }
    }
 catch (    IOException e) {
    }
  }
  initMeasureNavigator();
}