Program: 81525
Project: 81525
Buggy source:
/** 
 * This method transforms given XLS input stream template into multiple sheets workbook creating separate Excel worksheet for every object in the list
 * @param is        - {@link InputStream} for source XLS template file
 * @param objects   - List of beans where each list item should be exported into a separated worksheet
 * @param newSheetNames - Sheet names to be used for newly created worksheets
 * @param beanName - Bean name to be used for a list item when processing sheet
 * @param beanParams - Common bean map containing all other objects to be used in the workbook
 * @param startSheetNum - Worksheet number (zero based) of the worksheet that needs to be used to create multiple worksheets
 * @return new {@link HSSFWorkbook} object containing the result of transformation
 * @throws net.sf.jxls.exception.ParsePropertyException - {@link ParsePropertyException} is thrown when some property can't be parsed
 */
public HSSFWorkbook transformMultipleSheetsList(InputStream is,List objects,List newSheetNames,String beanName,Map beanParams,int startSheetNum) throws ParsePropertyException {
  HSSFWorkbook hssfWorkbook=null;
  try {
    if (beanParams != null && beanParams.containsKey(beanName)) {
      throw new IllegalArgumentException("String_Node_Str" + beanName + "String_Node_Str");
    }
    if (beanName == null) {
      throw new IllegalArgumentException(("String_Node_Str"));
    }
    if (beanParams == null) {
      beanParams=new HashMap();
    }
    POIFSFileSystem fs=new POIFSFileSystem(is);
    hssfWorkbook=new HSSFWorkbook(fs);
    preprocess(hssfWorkbook);
    Workbook workbook=createWorkbook(hssfWorkbook);
    workbookTransformationController=new WorkbookTransformationControllerImpl(workbook);
    SheetTransformer sheetTransformer=new SheetTransformer(fixedSizeCollections,groupedCollections,rowProcessors,cellProcessors,configuration);
    final String templateSheetName="String_Node_Str";
    for (int sheetNo=0; sheetNo < hssfWorkbook.getNumberOfSheets(); sheetNo++) {
      final String spreadsheetName=hssfWorkbook.getSheetName(sheetNo);
      if (!isSpreadsheetToHide(spreadsheetName)) {
        if (isSpreadsheetToRename(spreadsheetName)) {
          hssfWorkbook.setSheetName(sheetNo,getSpreadsheetToReName(spreadsheetName));
        }
        HSSFSheet hssfSheet=hssfWorkbook.getSheetAt(sheetNo);
        if (startSheetNum == sheetNo && objects != null && !objects.isEmpty()) {
          Object firstBean=objects.get(0);
          beanParams.put(beanName,firstBean);
          hssfWorkbook.setSheetName(sheetNo,(String)newSheetNames.get(0),HSSFWorkbook.ENCODING_UTF_16);
          HSSFSheet templateSheet=hssfWorkbook.createSheet(templateSheetName);
          Util.copySheets(templateSheet,hssfSheet);
          Sheet sheet=workbook.getSheetAt(sheetNo);
          sheetTransformer.transformSheet(workbookTransformationController,sheet,beanParams);
          for (int i=1; i < objects.size(); i++) {
            Object bean=objects.get(i);
            beanParams.put(beanName,bean);
            HSSFSheet newSheet=hssfWorkbook.createSheet((String)newSheetNames.get(i));
            Util.copySheets(newSheet,templateSheet);
            Util.copyPageSetup(newSheet,hssfSheet);
            Util.copyPrintSetup(newSheet,hssfSheet);
            sheet=new Sheet(hssfWorkbook,newSheet,configuration);
            workbook.addSheet(sheet);
            workbook.initSheetNames();
            sheetTransformer.transformSheet(workbookTransformationController,sheet,beanParams);
          }
          hssfWorkbook.removeSheetAt(hssfWorkbook.getSheetIndex(templateSheetName));
          beanParams.remove(beanName);
        }
 else {
          Sheet sheet=workbook.getSheetAt(sheetNo);
          sheetTransformer.transformSheet(workbookTransformationController,sheet,beanParams);
        }
      }
 else {
        hssfWorkbook.removeSheetAt(sheetNo);
        workbook.getSheets().remove(sheetNo);
        sheetNo--;
      }
    }
    updateFormulas();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  if (hssfWorkbook != null) {
    for (int i=0; i < hssfWorkbook.getNumberOfSheets(); i++) {
      Util.setPrintArea(hssfWorkbook,i);
    }
  }
  return hssfWorkbook;
}

Fixed version (ground truth):
/** 
 * This method transforms given XLS input stream template into multiple sheets workbook creating separate Excel worksheet for every object in the list
 * @param is        - {@link InputStream} for source XLS template file
 * @param objects   - List of beans where each list item should be exported into a separated worksheet
 * @param newSheetNames - Sheet names to be used for newly created worksheets
 * @param beanName - Bean name to be used for a list item when processing sheet
 * @param beanParams - Common bean map containing all other objects to be used in the workbook
 * @param startSheetNum - Worksheet number (zero based) of the worksheet that needs to be used to create multiple worksheets
 * @return new {@link HSSFWorkbook} object containing the result of transformation
 * @throws net.sf.jxls.exception.ParsePropertyException - {@link ParsePropertyException} is thrown when some property can't be parsed
 */
public HSSFWorkbook transformMultipleSheetsList(InputStream is,List objects,List newSheetNames,String beanName,Map beanParams,int startSheetNum) throws ParsePropertyException {
  HSSFWorkbook hssfWorkbook=null;
  try {
    if (beanParams != null && beanParams.containsKey(beanName)) {
      throw new IllegalArgumentException("String_Node_Str" + beanName + "String_Node_Str");
    }
    if (beanName == null) {
      throw new IllegalArgumentException(("String_Node_Str"));
    }
    if (beanParams == null) {
      beanParams=new HashMap();
    }
    POIFSFileSystem fs=new POIFSFileSystem(is);
    hssfWorkbook=new HSSFWorkbook(fs);
    preprocess(hssfWorkbook);
    Workbook workbook=createWorkbook(hssfWorkbook);
    workbookTransformationController=new WorkbookTransformationControllerImpl(workbook);
    SheetTransformer sheetTransformer=new SheetTransformer(fixedSizeCollections,groupedCollections,rowProcessors,cellProcessors,configuration);
    final String templateSheetName="String_Node_Str";
    for (int sheetNo=0; sheetNo < hssfWorkbook.getNumberOfSheets(); sheetNo++) {
      final String spreadsheetName=hssfWorkbook.getSheetName(sheetNo);
      if (!isSpreadsheetToHide(spreadsheetName)) {
        if (isSpreadsheetToRename(spreadsheetName)) {
          hssfWorkbook.setSheetName(sheetNo,getSpreadsheetToReName(spreadsheetName));
        }
        HSSFSheet hssfSheet=hssfWorkbook.getSheetAt(sheetNo);
        if (startSheetNum == sheetNo && objects != null && !objects.isEmpty()) {
          Object firstBean=objects.get(0);
          beanParams.put(beanName,firstBean);
          hssfWorkbook.setSheetName(sheetNo,(String)newSheetNames.get(0),HSSFWorkbook.ENCODING_UTF_16);
          HSSFSheet templateSheet=hssfWorkbook.createSheet(templateSheetName);
          Util.copySheets(templateSheet,hssfSheet);
          Sheet sheet=workbook.getSheetAt(sheetNo);
          sheetTransformer.transformSheet(workbookTransformationController,sheet,beanParams);
          for (int i=1; i < objects.size(); i++) {
            Object bean=objects.get(i);
            beanParams.put(beanName,bean);
            HSSFSheet newSheet=hssfWorkbook.createSheet((String)newSheetNames.get(i));
            Util.copySheets(newSheet,templateSheet);
            Util.copyPageSetup(newSheet,hssfSheet);
            Util.copyPrintSetup(newSheet,hssfSheet);
            sheet=new Sheet(hssfWorkbook,newSheet,configuration);
            workbook.addSheet(sheet);
            workbook.initSheetNames();
            sheetTransformer.transformSheet(workbookTransformationController,sheet,beanParams);
          }
          hssfWorkbook.removeSheetAt(hssfWorkbook.getSheetIndex(templateSheetName));
          beanParams.remove(beanName);
        }
 else {
          Sheet sheet=workbook.getSheetAt(sheetNo);
          sheetTransformer.transformSheet(workbookTransformationController,sheet,beanParams);
        }
      }
 else {
        workbook.removeSheetAt(sheetNo);
        sheetNo--;
      }
    }
    updateFormulas();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  if (hssfWorkbook != null) {
    for (int i=0; i < hssfWorkbook.getNumberOfSheets(); i++) {
      Util.setPrintArea(hssfWorkbook,i);
    }
  }
  return hssfWorkbook;
}