Program: 81524
Project: 81524
Buggy source:
/** 
 * Multiple sheet template multiple transform. It can be used to generate a workbook with N (N=N1+N2+...+Nn) sheets based on : - N1 transformations of the sheet template T1 - N2 transformations of the sheet template T2 ... - Nn transformations of the sheet template Tn
 * @param is  the {@link InputStream} of the workbook template containing the n template sheets
 * @param templateSheetNameList  the ordered list of the template sheet name used in the transformation.
 * @param sheetNameList  the ordered list of the resulting sheet name after transformation
 * @param beanParamsList  the ordered list of beanParams used in the transformation
 * @return - {@link HSSFWorkbook} representing transformation result
 * @throws ParsePropertyException  in case property parsing failure
 */
public HSSFWorkbook transformXLS(InputStream is,List templateSheetNameList,List sheetNameList,List beanParamsList) throws ParsePropertyException {
  HSSFWorkbook hssfWorkbook=null;
  try {
    POIFSFileSystem fs=new POIFSFileSystem(is);
    hssfWorkbook=new HSSFWorkbook(fs);
    int numberOfSheets=hssfWorkbook.getNumberOfSheets();
    for (int templateSheetIndex=0; templateSheetIndex < templateSheetNameList.size(); templateSheetIndex++) {
      String templateSheetName=(String)templateSheetNameList.get(templateSheetIndex);
      String sheetName=(String)sheetNameList.get(templateSheetIndex);
      for (int workbookSheetIndex=0; workbookSheetIndex < numberOfSheets; workbookSheetIndex++) {
        if (templateSheetName.equals(hssfWorkbook.getSheetName(workbookSheetIndex))) {
          cloneSheet(hssfWorkbook,workbookSheetIndex,sheetName);
          break;
        }
      }
    }
    for (int i=0; i < numberOfSheets; i++) {
      hssfWorkbook.removeSheetAt(0);
    }
    Workbook workbook=createWorkbook(hssfWorkbook);
    workbookTransformationController=new WorkbookTransformationControllerImpl(workbook);
    preprocess(hssfWorkbook);
    SheetTransformer sheetTransformer=new SheetTransformer(fixedSizeCollections,groupedCollections,rowProcessors,cellProcessors,configuration);
    for (int sheetNo=0; sheetNo < workbook.getNumberOfSheets(); sheetNo++) {
      final String spreadsheetName=hssfWorkbook.getSheetName(sheetNo);
      if (!isSpreadsheetToHide(spreadsheetName)) {
        if (isSpreadsheetToRename(spreadsheetName)) {
          hssfWorkbook.setSheetName(sheetNo,getSpreadsheetToReName(spreadsheetName));
        }
        Sheet sheet=workbook.getSheetAt(sheetNo);
        Map beanParams=(Map)beanParamsList.get(sheetNo);
        beanParams.put("String_Node_Str",String.valueOf(sheetNo));
        sheetTransformer.transformSheet(workbookTransformationController,sheet,beanParams);
      }
 else {
        hssfWorkbook.removeSheetAt(sheetNo);
        sheetNo--;
      }
    }
    updateFormulas();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  return hssfWorkbook;
}

Fixed version (ground truth):
/** 
 * Multiple sheet template multiple transform. It can be used to generate a workbook with N (N=N1+N2+...+Nn) sheets based on : - N1 transformations of the sheet template T1 - N2 transformations of the sheet template T2 ... - Nn transformations of the sheet template Tn
 * @param is  the {@link InputStream} of the workbook template containing the n template sheets
 * @param templateSheetNameList  the ordered list of the template sheet name used in the transformation.
 * @param sheetNameList  the ordered list of the resulting sheet name after transformation
 * @param beanParamsList  the ordered list of beanParams used in the transformation
 * @return - {@link HSSFWorkbook} representing transformation result
 * @throws ParsePropertyException  in case property parsing failure
 */
public HSSFWorkbook transformXLS(InputStream is,List templateSheetNameList,List sheetNameList,List beanParamsList) throws ParsePropertyException {
  HSSFWorkbook hssfWorkbook=null;
  try {
    POIFSFileSystem fs=new POIFSFileSystem(is);
    hssfWorkbook=new HSSFWorkbook(fs);
    int numberOfSheets=hssfWorkbook.getNumberOfSheets();
    for (int templateSheetIndex=0; templateSheetIndex < templateSheetNameList.size(); templateSheetIndex++) {
      String templateSheetName=(String)templateSheetNameList.get(templateSheetIndex);
      String sheetName=(String)sheetNameList.get(templateSheetIndex);
      for (int workbookSheetIndex=0; workbookSheetIndex < numberOfSheets; workbookSheetIndex++) {
        if (templateSheetName.equals(hssfWorkbook.getSheetName(workbookSheetIndex))) {
          cloneSheet(hssfWorkbook,workbookSheetIndex,sheetName);
          break;
        }
      }
    }
    for (int i=0; i < numberOfSheets; i++) {
      hssfWorkbook.removeSheetAt(0);
    }
    Workbook workbook=createWorkbook(hssfWorkbook);
    workbookTransformationController=new WorkbookTransformationControllerImpl(workbook);
    preprocess(hssfWorkbook);
    SheetTransformer sheetTransformer=new SheetTransformer(fixedSizeCollections,groupedCollections,rowProcessors,cellProcessors,configuration);
    for (int sheetNo=0; sheetNo < workbook.getNumberOfSheets(); sheetNo++) {
      final String spreadsheetName=hssfWorkbook.getSheetName(sheetNo);
      if (!isSpreadsheetToHide(spreadsheetName)) {
        if (isSpreadsheetToRename(spreadsheetName)) {
          hssfWorkbook.setSheetName(sheetNo,getSpreadsheetToReName(spreadsheetName));
        }
        Sheet sheet=workbook.getSheetAt(sheetNo);
        Map beanParams=(Map)beanParamsList.get(sheetNo);
        beanParams.put("String_Node_Str",String.valueOf(sheetNo));
        sheetTransformer.transformSheet(workbookTransformationController,sheet,beanParams);
      }
 else {
        workbook.removeSheetAt(sheetNo);
        sheetNo--;
      }
    }
    updateFormulas();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  return hssfWorkbook;
}