Program: 78493
Project: 78493
Buggy source:
/** 
 * execute a grid. The execution process is: <li> create a Table content <li> push it into the stack <li> execute the query and seek to the first record <li> process the table style, visiblity, action, bookmark <li> execute the onCreate if necessary. <li> call emitter to start the grid. <li> for each row, execute the row. <li> call emitter to close the grid. <li> close the query <li> popup the table.
 * @see org.eclipse.birt.report.engine.excutor.ReportItemExcutor#excute()
 */
public void execute(ReportItemDesign item,IContentEmitter emitter){
  GridItemDesign gridItem=(GridItemDesign)item;
  ITableContent tableObj=report.createTableContent();
  IContent parent=context.getContent();
  context.pushContent(tableObj);
  openResultSet(item);
  accessQuery(item,emitter);
  initializeContent(parent,item,tableObj);
  processAction(item,tableObj);
  processBookmark(item,tableObj);
  processStyle(item,tableObj);
  processVisibility(item,tableObj);
  for (int i=0; i < gridItem.getColumnCount(); i++) {
    ColumnDesign columnDesign=gridItem.getColumn(i);
    Column column=new Column();
    column.setStyleClass(columnDesign.getStyleName());
    column.setWidth(columnDesign.getWidth());
    tableObj.addColumn(column);
  }
  IBaseQueryDefinition query=item.getQuery();
  IRowData rowData=null;
  if (query != null) {
    Collection rowExpressions=(query.getRowExpressions());
    IResultIterator rsIterator=((DteResultSet)rset).getResultIterator();
    rowData=new RowData(rsIterator,rowExpressions);
  }
  if (context.isInFactory()) {
    GridScriptExecutor.handleOnCreate((TableContent)tableObj,rowData,context);
  }
  startTOCEntry(tableObj);
  if (emitter != null) {
    emitter.startTable(tableObj);
  }
  ITableBandContent body=report.createTableBody();
  initializeContent(tableObj,null,body);
  context.pushContent(body);
  startTOCEntry(body);
  if (emitter != null) {
    emitter.startTableBody(body);
  }
  for (int i=0; i < gridItem.getRowCount(); i++) {
    RowDesign row=gridItem.getRow(i);
    if (row != null) {
      executeRow(i,body,row,emitter);
    }
  }
  if (emitter != null) {
    emitter.endTableBody(body);
  }
  finishTOCEntry();
  context.popContent();
  if (emitter != null) {
    emitter.endTable(tableObj);
  }
  finishTOCEntry();
  closeResultSet();
  context.popContent();
}

Fixed version (ground truth):
/** 
 * execute a grid. The execution process is: <li> create a Table content <li> push it into the stack <li> execute the query and seek to the first record <li> process the table style, visiblity, action, bookmark <li> execute the onCreate if necessary. <li> call emitter to start the grid. <li> for each row, execute the row. <li> call emitter to close the grid. <li> close the query <li> popup the table.
 * @see org.eclipse.birt.report.engine.excutor.ReportItemExcutor#excute()
 */
public void execute(ReportItemDesign item,IContentEmitter emitter){
  GridItemDesign gridItem=(GridItemDesign)item;
  ITableContent tableObj=report.createTableContent();
  IContent parent=context.getContent();
  context.pushContent(tableObj);
  openResultSet(item);
  accessQuery(item,emitter);
  initializeContent(parent,item,tableObj);
  processAction(item,tableObj);
  processBookmark(item,tableObj);
  processStyle(item,tableObj);
  processVisibility(item,tableObj);
  for (int i=0; i < gridItem.getColumnCount(); i++) {
    ColumnDesign columnDesign=gridItem.getColumn(i);
    Column column=new Column();
    column.setStyleClass(columnDesign.getStyleName());
    column.setWidth(columnDesign.getWidth());
    tableObj.addColumn(column);
  }
  if (context.isInFactory()) {
    GridScriptExecutor.handleOnCreate((TableContent)tableObj,context);
  }
  startTOCEntry(tableObj);
  if (emitter != null) {
    emitter.startTable(tableObj);
  }
  ITableBandContent body=report.createTableBody();
  initializeContent(tableObj,null,body);
  context.pushContent(body);
  startTOCEntry(body);
  if (emitter != null) {
    emitter.startTableBody(body);
  }
  for (int i=0; i < gridItem.getRowCount(); i++) {
    RowDesign row=gridItem.getRow(i);
    if (row != null) {
      executeRow(i,body,row,emitter);
    }
  }
  if (emitter != null) {
    emitter.endTableBody(body);
  }
  finishTOCEntry();
  context.popContent();
  if (emitter != null) {
    emitter.endTable(tableObj);
  }
  finishTOCEntry();
  closeResultSet();
  context.popContent();
}