Program: 78979
Project: 78979
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);
  }
  if (context.isInFactory()) {
    TableScriptExecutor.handleOnCreate((TableContent)tableObj,context);
  }
  if (emitter != null) {
    emitter.startTable(tableObj);
  }
  ITableBandContent body=report.createTableBandContent();
  body.setParent(tableObj);
  context.pushContent(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);
  }
  context.popContent();
  if (emitter != null) {
    emitter.endTable(tableObj);
  }
  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()) {
    try {
      context.newScope(tableObj);
      GridScriptExecutor.handleOnCreate((TableContent)tableObj,null,context);
    }
  finally {
      context.exitScope();
    }
  }
  if (emitter != null) {
    emitter.startTable(tableObj);
  }
  ITableBandContent body=report.createTableBandContent();
  body.setParent(tableObj);
  context.pushContent(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);
  }
  context.popContent();
  if (emitter != null) {
    emitter.endTable(tableObj);
  }
  closeResultSet();
  context.popContent();
}