Program: 81527
Project: 81527
Buggy source:
public ResultTransformation process(SheetTransformer sheetTransformer){
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str" + var + "String_Node_Str"+ items);
    log.debug("String_Node_Str" + tagContext);
    log.debug("String_Node_Str" + itemsCollection);
  }
  Block body=tagContext.getTagBody();
  if (body.getNumberOfRows() == 1) {
    return processOneRowTag(sheetTransformer);
  }
  int shiftNumber=0;
  if (itemsCollection != null && !itemsCollection.isEmpty()) {
    tagContext.getSheetTransformationController().removeBorders(body);
    shiftNumber+=-2;
    ResultTransformation shift=new ResultTransformation(0);
    Map beans=tagContext.getBeans();
    int k=0;
    ResultTransformation processResult;
    int startRowNum, endRowNum;
    if (groupBy == null || groupBy.length() == 0) {
      Collection c2=new ArrayList();
      for (Iterator iterator=itemsCollection.iterator(); iterator.hasNext(); ) {
        Object o=iterator.next();
        beans.put(var,o);
        if (ReportUtil.shouldSelectCollectionData(beans,select,configuration)) {
          c2.add(o);
        }
      }
      shiftNumber+=tagContext.getSheetTransformationController().duplicateDown(body,c2.size() - 1);
      for (Iterator iterator=c2.iterator(); iterator.hasNext(); ) {
        Object o=iterator.next();
        beans.put(var,o);
        if (ReportUtil.shouldSelectCollectionData(beans,select,configuration)) {
          try {
            startRowNum=body.getStartRowNum() + shift.getLastRowShift() + body.getNumberOfRows() * k++;
            endRowNum=startRowNum + body.getNumberOfRows() - 1;
            processResult=sheetTransformer.processRows(tagContext.getSheetTransformationController(),tagContext.getSheet(),startRowNum,endRowNum,beans,null);
            shift.add(processResult);
          }
 catch (          ParsePropertyException e) {
            log.error("String_Node_Str",e);
            throw new RuntimeException("String_Node_Str",e);
          }
        }
      }
    }
 else {
      try {
        Collection groupedData=ReportUtil.groupCollectionData(itemsCollection,groupBy,groupOrder,select,configuration);
        shiftNumber+=tagContext.getSheetTransformationController().duplicateDown(body,groupedData.size() - 1);
        Object savedGroupData=null;
        if (beans.containsKey(GROUP_DATA_KEY)) {
          savedGroupData=beans.get(GROUP_DATA_KEY);
        }
        for (Iterator iterator=groupedData.iterator(); iterator.hasNext(); ) {
          GroupData groupData=(GroupData)iterator.next();
          beans.put(GROUP_DATA_KEY,groupData);
          try {
            startRowNum=body.getStartRowNum() + shift.getLastRowShift() + body.getNumberOfRows() * k++;
            endRowNum=startRowNum + body.getNumberOfRows() - 1;
            processResult=sheetTransformer.processRows(tagContext.getSheetTransformationController(),tagContext.getSheet(),startRowNum,endRowNum,beans,null);
            shift.add(processResult);
          }
 catch (          ParsePropertyException e) {
            log.error("String_Node_Str",e);
          }
        }
        beans.remove(GROUP_DATA_KEY);
        if (savedGroupData != null) {
          beans.put(GROUP_DATA_KEY,savedGroupData);
        }
      }
 catch (      NoSuchMethodException e) {
        log.error(e,new Exception("String_Node_Str" + groupBy,e));
      }
catch (      IllegalAccessException e) {
        log.error(e,new Exception("String_Node_Str" + groupBy,e));
      }
catch (      InvocationTargetException e) {
        log.error(e,new Exception("String_Node_Str" + groupBy,e));
      }
    }
    shift.add(new ResultTransformation(shiftNumber,shiftNumber));
    shift.setTagProcessResult(true);
    return shift;
  }
 else {
    log.warn("String_Node_Str" + items + "String_Node_Str");
    tagContext.getSheetTransformationController().removeBodyRows(body);
    ResultTransformation shift=new ResultTransformation(0);
    shift.add(new ResultTransformation(-1,-body.getNumberOfRows()));
    shift.setLastProcessedRow(-1);
    shift.setTagProcessResult(true);
    return shift;
  }
}

Fixed version (ground truth):
public ResultTransformation process(SheetTransformer sheetTransformer){
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str" + var + "String_Node_Str"+ items);
    log.debug("String_Node_Str" + tagContext);
    log.debug("String_Node_Str" + itemsCollection);
  }
  Block body=tagContext.getTagBody();
  if (body.getNumberOfRows() == 1) {
    return processOneRowTag(sheetTransformer);
  }
  int shiftNumber=0;
  if (itemsCollection != null && !itemsCollection.isEmpty()) {
    tagContext.getSheetTransformationController().removeBorders(body);
    shiftNumber+=-2;
    ResultTransformation shift=new ResultTransformation(0);
    Map beans=tagContext.getBeans();
    int k=0;
    ResultTransformation processResult;
    int startRowNum, endRowNum;
    if (groupBy == null || groupBy.length() == 0) {
      Collection c2=new ArrayList();
      for (Iterator iterator=itemsCollection.iterator(); iterator.hasNext(); ) {
        Object o=iterator.next();
        beans.put(var,o);
        if (ReportUtil.shouldSelectCollectionData(beans,select,configuration)) {
          c2.add(o);
        }
      }
      shiftNumber+=tagContext.getSheetTransformationController().duplicateDown(body,c2.size() - 1);
      for (Iterator iterator=c2.iterator(); iterator.hasNext(); ) {
        Object o=iterator.next();
        beans.put(var,o);
        try {
          startRowNum=body.getStartRowNum() + shift.getLastRowShift() + body.getNumberOfRows() * k++;
          endRowNum=startRowNum + body.getNumberOfRows() - 1;
          processResult=sheetTransformer.processRows(tagContext.getSheetTransformationController(),tagContext.getSheet(),startRowNum,endRowNum,beans,null);
          shift.add(processResult);
        }
 catch (        ParsePropertyException e) {
          log.error("String_Node_Str",e);
          throw new RuntimeException("String_Node_Str",e);
        }
      }
    }
 else {
      try {
        Collection groupedData=ReportUtil.groupCollectionData(itemsCollection,groupBy,groupOrder,select,configuration);
        shiftNumber+=tagContext.getSheetTransformationController().duplicateDown(body,groupedData.size() - 1);
        Object savedGroupData=null;
        if (beans.containsKey(GROUP_DATA_KEY)) {
          savedGroupData=beans.get(GROUP_DATA_KEY);
        }
        for (Iterator iterator=groupedData.iterator(); iterator.hasNext(); ) {
          GroupData groupData=(GroupData)iterator.next();
          beans.put(GROUP_DATA_KEY,groupData);
          try {
            startRowNum=body.getStartRowNum() + shift.getLastRowShift() + body.getNumberOfRows() * k++;
            endRowNum=startRowNum + body.getNumberOfRows() - 1;
            processResult=sheetTransformer.processRows(tagContext.getSheetTransformationController(),tagContext.getSheet(),startRowNum,endRowNum,beans,null);
            shift.add(processResult);
          }
 catch (          ParsePropertyException e) {
            log.error("String_Node_Str",e);
          }
        }
        beans.remove(GROUP_DATA_KEY);
        if (savedGroupData != null) {
          beans.put(GROUP_DATA_KEY,savedGroupData);
        }
      }
 catch (      NoSuchMethodException e) {
        log.error(e,new Exception("String_Node_Str" + groupBy,e));
      }
catch (      IllegalAccessException e) {
        log.error(e,new Exception("String_Node_Str" + groupBy,e));
      }
catch (      InvocationTargetException e) {
        log.error(e,new Exception("String_Node_Str" + groupBy,e));
      }
    }
    shift.add(new ResultTransformation(shiftNumber,shiftNumber));
    shift.setTagProcessResult(true);
    return shift;
  }
 else {
    log.warn("String_Node_Str" + items + "String_Node_Str");
    tagContext.getSheetTransformationController().removeBodyRows(body);
    ResultTransformation shift=new ResultTransformation(0);
    shift.add(new ResultTransformation(-1,-body.getNumberOfRows()));
    shift.setLastProcessedRow(-1);
    shift.setTagProcessResult(true);
    return shift;
  }
}