Program: 39945
Project: 39945
Buggy source:
/** 
 * 根据业务对象（包含子集合的BO）集合创建工作簿
 * @param material 申报表所属教材对象
 * @param dataSource 业务对象（BO）集合
 * @param sheetName 要生成的Excel表名（非文件名）
 * @return Excel工作簿
 */
public Workbook fromDeclarationEtcBOList(Material material,List<DeclarationEtcBO> dataSource,String sheetName) throws CheckedServiceException, IllegalArgumentException, IllegalAccessException {
  if (null == dataSource || dataSource.isEmpty()) {
    throw new CheckedServiceException(CheckedExceptionBusiness.MATERIAL,CheckedExceptionResult.NULL_PARAM,"String_Node_Str");
  }
  Workbook workbook=new HSSFWorkbook();
  Sheet sheet=workbook.createSheet(sheetName);
  sheet=generateDeclarationEtcBOHeader(sheet);
  headerStyleSetup(workbook,2);
  Field[] fields=dataSource.get(0).getClass().getDeclaredFields();
  int rowCount=2;
  ColumnProperties columnProperties=new ColumnProperties(1,new int[sheet.getRow(1).getLastCellNum()]);
  Iterator iterator=dataSource.iterator();
  while (iterator.hasNext()) {
    Object object=iterator.next();
    Row row=sheet.createRow(rowCount);
    row.createCell(0).setCellValue(String.valueOf(rowCount - 1));
    columnProperties.setMaxElement(0,2);
    columnProperties.setColCount(1);
    for (    Field field : fields) {
      field.setAccessible(true);
      if (field.isAnnotationPresent(ExcelHeader.class)) {
        ExcelHeader excelHeader=(ExcelHeader)field.getAnnotation(ExcelHeader.class);
        String headerName=excelHeader.header();
        if (StringUtil.notEmpty(headerName)) {
switch (headerName) {
case "String_Node_Str":
{
              List<DecEduExp> list=(List<DecEduExp>)field.get(object);
              columnProperties=fillDecEduExpData(list,row,columnProperties);
              break;
            }
case "String_Node_Str":
{
            List<DecWorkExp> list=(List<DecWorkExp>)field.get(object);
            columnProperties=fillDecWorkExpData(list,row,columnProperties);
            break;
          }
case "String_Node_Str":
{
          List<DecTeachExp> list=(List<DecTeachExp>)field.get(object);
          columnProperties=fillDecTeachExpData(list,row,columnProperties);
          break;
        }
case "String_Node_Str":
{
        List<DecAcade> list=(List<DecAcade>)field.get(object);
        columnProperties=fillDecAcadeData(list,row,columnProperties);
        break;
      }
case "String_Node_Str":
{
      List<DecLastPosition> list=(List<DecLastPosition>)field.get(object);
      columnProperties=fillDecLastPositionData(list,row,columnProperties);
      break;
    }
case "String_Node_Str":
{
    List<DecCourseConstruction> list=(List<DecCourseConstruction>)field.get(object);
    columnProperties=fillDecCourseConstructionData(list,row,columnProperties);
    break;
  }
case "String_Node_Str":
{
  List<DecNationalPlan> list=(List<DecNationalPlan>)field.get(object);
  columnProperties=fillDecNationalPlanData(list,row,columnProperties);
  break;
}
case "String_Node_Str":
{
List<DecTextbookPmph> list=(List<DecTextbookPmph>)field.get(object);
columnProperties=fillDecTextbookPmphData(list,row,columnProperties);
break;
}
case "String_Node_Str":
{
List<DecTextbook> list=(List<DecTextbook>)field.get(object);
columnProperties=fillDecTextbookData(list,row,columnProperties);
break;
}
case "String_Node_Str":
{
List<DecResearch> list=(List<DecResearch>)field.get(object);
columnProperties=fillDecResearchData(list,row,columnProperties);
break;
}
case "String_Node_Str":
{
List<DecMonograph> list=(List<DecMonograph>)field.get(object);
columnProperties=fillDecMonographData(list,row,columnProperties);
break;
}
case "String_Node_Str":
{
List<DecPublishReward> list=(List<DecPublishReward>)field.get(object);
columnProperties=fillDecPublishRewardData(list,row,columnProperties);
break;
}
case "String_Node_Str":
{
List<DecSci> list=(List<DecSci>)field.get(object);
columnProperties=fillDecSciData(list,row,columnProperties);
break;
}
case "String_Node_Str":
{
List<DecClinicalReward> list=(List<DecClinicalReward>)field.get(object);
columnProperties=fillDecClinicalRewardData(list,row,columnProperties);
break;
}
case "String_Node_Str":
{
List<DecAcadeReward> list=(List<DecAcadeReward>)field.get(object);
columnProperties=fillDecAcadeRewardData(list,row,columnProperties);
break;
}
case "String_Node_Str":
{
List<DecExtensionVO> list=(List<DecExtensionVO>)field.get(object);
columnProperties=fillDecExtensionVOData(list,row,columnProperties);
break;
}
default :
Object o=field.get(object);
Cell cell=row.createCell(columnProperties.getColCount());
if (null != o) {
String value=o.toString();
cell.setCellValue(value);
if (value.length() > columnProperties.getCurrentMaxElement()) {
columnProperties.setCurrentMaxElement(value.length());
}
}
columnProperties.setColCount(columnProperties.getColCount() + 1);
break;
}
}
}
}
rowCount++;
}
workbook=dataStyleSetup(workbook,2,rowCount,columnProperties);
return clearColumns(workbook,material);
}

Fixed version (ground truth):
/** 
 * 根据业务对象（包含子集合的BO）集合创建工作簿
 * @param material 申报表所属教材对象
 * @param extensions 教材扩展项集合
 * @param dataSource 业务对象（BO）集合
 * @param sheetName 要生成的Excel表名（非文件名）
 * @return Excel工作簿
 */
public Workbook fromDeclarationEtcBOList(Material material,List<MaterialExtension> extensions,List<DeclarationEtcBO> dataSource,String sheetName) throws CheckedServiceException, IllegalArgumentException, IllegalAccessException {
  if (null == dataSource || dataSource.isEmpty()) {
    throw new CheckedServiceException(CheckedExceptionBusiness.MATERIAL,CheckedExceptionResult.NULL_PARAM,"String_Node_Str");
  }
  Workbook workbook=new HSSFWorkbook();
  Sheet sheet=workbook.createSheet(sheetName);
  sheet=generateDeclarationEtcBOHeader(extensions,sheet);
  headerStyleSetup(workbook,2);
  Field[] fields=dataSource.get(0).getClass().getDeclaredFields();
  int rowCount=2;
  ColumnProperties columnProperties=new ColumnProperties(1,new int[sheet.getRow(1).getLastCellNum()]);
  Iterator iterator=dataSource.iterator();
  while (iterator.hasNext()) {
    Object object=iterator.next();
    Row row=sheet.createRow(rowCount);
    row.createCell(0).setCellValue(String.valueOf(rowCount - 1));
    columnProperties.setMaxElement(0,2);
    columnProperties.setColCount(1);
    for (    Field field : fields) {
      field.setAccessible(true);
      if (field.isAnnotationPresent(ExcelHeader.class)) {
        ExcelHeader excelHeader=(ExcelHeader)field.getAnnotation(ExcelHeader.class);
        String headerName=excelHeader.header();
        if (StringUtil.notEmpty(headerName)) {
switch (headerName) {
case "String_Node_Str":
{
              List<DecEduExp> list=(List<DecEduExp>)field.get(object);
              columnProperties=fillDecEduExpData(list,row,columnProperties);
              break;
            }
case "String_Node_Str":
{
            List<DecWorkExp> list=(List<DecWorkExp>)field.get(object);
            columnProperties=fillDecWorkExpData(list,row,columnProperties);
            break;
          }
case "String_Node_Str":
{
          List<DecTeachExp> list=(List<DecTeachExp>)field.get(object);
          columnProperties=fillDecTeachExpData(list,row,columnProperties);
          break;
        }
case "String_Node_Str":
{
        List<DecAcade> list=(List<DecAcade>)field.get(object);
        columnProperties=fillDecAcadeData(list,row,columnProperties);
        break;
      }
case "String_Node_Str":
{
      List<DecLastPosition> list=(List<DecLastPosition>)field.get(object);
      columnProperties=fillDecLastPositionData(list,row,columnProperties);
      break;
    }
case "String_Node_Str":
{
    List<DecCourseConstruction> list=(List<DecCourseConstruction>)field.get(object);
    columnProperties=fillDecCourseConstructionData(list,row,columnProperties);
    break;
  }
case "String_Node_Str":
{
  List<DecNationalPlan> list=(List<DecNationalPlan>)field.get(object);
  columnProperties=fillDecNationalPlanData(list,row,columnProperties);
  break;
}
case "String_Node_Str":
{
List<DecTextbookPmph> list=(List<DecTextbookPmph>)field.get(object);
columnProperties=fillDecTextbookPmphData(list,row,columnProperties);
break;
}
case "String_Node_Str":
{
List<DecTextbook> list=(List<DecTextbook>)field.get(object);
columnProperties=fillDecTextbookData(list,row,columnProperties);
break;
}
case "String_Node_Str":
{
List<DecResearch> list=(List<DecResearch>)field.get(object);
columnProperties=fillDecResearchData(list,row,columnProperties);
break;
}
case "String_Node_Str":
{
List<DecMonograph> list=(List<DecMonograph>)field.get(object);
columnProperties=fillDecMonographData(list,row,columnProperties);
break;
}
case "String_Node_Str":
{
List<DecPublishReward> list=(List<DecPublishReward>)field.get(object);
columnProperties=fillDecPublishRewardData(list,row,columnProperties);
break;
}
case "String_Node_Str":
{
List<DecSci> list=(List<DecSci>)field.get(object);
columnProperties=fillDecSciData(list,row,columnProperties);
break;
}
case "String_Node_Str":
{
List<DecClinicalReward> list=(List<DecClinicalReward>)field.get(object);
columnProperties=fillDecClinicalRewardData(list,row,columnProperties);
break;
}
case "String_Node_Str":
{
List<DecAcadeReward> list=(List<DecAcadeReward>)field.get(object);
columnProperties=fillDecAcadeRewardData(list,row,columnProperties);
break;
}
case "String_Node_Str":
{
if (extensions == null || extensions.isEmpty()) {
break;
}
List<DecExtensionVO> list=(List<DecExtensionVO>)field.get(object);
columnProperties=fillDecExtensionVODataPlus(extensions,list,row,columnProperties);
break;
}
default :
Object o=field.get(object);
Cell cell=row.createCell(columnProperties.getColCount());
if (null != o) {
String value=o.toString();
cell.setCellValue(value);
if (value.length() > columnProperties.getCurrentMaxElement()) {
columnProperties.setCurrentMaxElement(value.length());
}
}
columnProperties.setColCount(columnProperties.getColCount() + 1);
break;
}
}
}
}
rowCount++;
}
workbook=dataStyleSetup(workbook,2,rowCount,columnProperties);
return clearColumns(workbook,material);
}