Program: 64899
Project: 64899
Buggy source:
public DesignElementHandle createElement(Object extendedData){
  boolean isTable=ReportDesignConstants.TABLE_ITEM.equals(getElementType());
  if (isTable) {
    TableOptionWizard wizard=new TableOptionWizard();
    WizardDialog dialog=new BaseWizardDialog(UIUtil.getDefaultShell(),wizard);
    if (dialog.open() == Window.OK) {
      Object[] result=(Object[])dialog.getResult();
      Object[] data=(Object[])result[0];
      boolean isSummaryTable=data.length > 2 && data[2] != null && ((Boolean)data[2]).booleanValue();
      Object[] datasetInfo=(Object[])result[1];
      int columnCount=((Integer)data[1]).intValue();
      int bindingCount=0;
      if (datasetInfo != null && datasetInfo[1] instanceof Object[]) {
        bindingCount=((Object[])datasetInfo[1]).length;
        if (bindingCount > 0) {
          columnCount=bindingCount;
        }
      }
      TableHandle table=DesignElementFactory.getInstance().newTableItem(null,columnCount,1,isSummaryTable ? 0 : ((Integer)data[0]).intValue(),1);
      InsertInLayoutUtil.setInitWidth(table);
      if (datasetInfo != null && datasetInfo[0] != null) {
        try {
          DataSetHandle dataSetHandle=(DataSetHandle)datasetInfo[0];
          ((ReportItemHandle)table).setDataSet(dataSetHandle);
          ((ReportItemHandle)table).setDataSet((DataSetHandle)datasetInfo[0]);
          DataSetColumnBindingsFormHandleProvider provider=new DataSetColumnBindingsFormHandleProvider();
          provider.setBindingObject(table);
          if (datasetInfo[1] instanceof Object[]) {
            Object[] selectedColumns=(Object[])datasetInfo[1];
            provider.generateBindingColumns(selectedColumns);
            if (bindingCount > 0) {
              ResultSetColumnHandle[] columns=new ResultSetColumnHandle[bindingCount];
              for (int i=0; i < selectedColumns.length; i++) {
                columns[i]=(ResultSetColumnHandle)selectedColumns[i];
              }
              InsertInLayoutUtil.insertToCell(dataSetHandle,table,table.getHeader(),columns,true);
              if (!isSummaryTable) {
                InsertInLayoutUtil.insertToCell(dataSetHandle,table,table.getDetail(),columns,false);
              }
            }
          }
        }
 catch (        Exception e) {
          ExceptionHandler.handle(e);
        }
      }
      if (isSummaryTable) {
        try {
          table.setIsSummaryTable(((Boolean)data[2]).booleanValue());
        }
 catch (        SemanticException e) {
          ExceptionHandler.handle(e);
        }
      }
      return table;
    }
  }
 else {
    TableOptionDialog dialog=new TableOptionDialog(UIUtil.getDefaultShell(),isTable);
    if (dialog.open() == Window.OK && dialog.getResult() instanceof Object[]) {
      Object[] data=(Object[])dialog.getResult();
      DesignElementHandle handle=DesignElementFactory.getInstance().newGridItem(getNewName(extendedData),((Integer)data[1]).intValue(),((Integer)data[0]).intValue());
      InsertInLayoutUtil.setInitWidth(handle);
      return handle;
    }
  }
  return null;
}

Fixed version (ground truth):
public DesignElementHandle createElement(Object extendedData){
  boolean isTable=ReportDesignConstants.TABLE_ITEM.equals(getElementType());
  if (isTable) {
    TableOptionBindingDialog dialog=new TableOptionBindingDialog(UIUtil.getDefaultShell());
    if (dialog.open() == Window.OK) {
      Object[] result=(Object[])dialog.getResult();
      Object[] data=(Object[])result[0];
      boolean isSummaryTable=data.length > 2 && data[2] != null && ((Boolean)data[2]).booleanValue();
      Object[] datasetInfo=(Object[])result[1];
      int columnCount=((Integer)data[1]).intValue();
      int bindingCount=0;
      if (datasetInfo != null && datasetInfo[1] instanceof Object[]) {
        bindingCount=((Object[])datasetInfo[1]).length;
        if (bindingCount > 0) {
          columnCount=bindingCount;
        }
      }
      TableHandle table=DesignElementFactory.getInstance().newTableItem(null,columnCount,1,isSummaryTable ? 0 : ((Integer)data[0]).intValue(),1);
      InsertInLayoutUtil.setInitWidth(table);
      if (datasetInfo != null && datasetInfo[0] != null) {
        try {
          DataSetHandle dataSetHandle=(DataSetHandle)datasetInfo[0];
          ((ReportItemHandle)table).setDataSet(dataSetHandle);
          ((ReportItemHandle)table).setDataSet((DataSetHandle)datasetInfo[0]);
          DataSetColumnBindingsFormHandleProvider provider=new DataSetColumnBindingsFormHandleProvider();
          provider.setBindingObject(table);
          if (datasetInfo[1] instanceof Object[]) {
            Object[] selectedColumns=(Object[])datasetInfo[1];
            provider.generateBindingColumns(selectedColumns);
            if (bindingCount > 0) {
              ResultSetColumnHandle[] columns=new ResultSetColumnHandle[bindingCount];
              for (int i=0; i < selectedColumns.length; i++) {
                columns[i]=(ResultSetColumnHandle)selectedColumns[i];
              }
              InsertInLayoutUtil.insertToCell(dataSetHandle,table,table.getHeader(),columns,true);
              if (!isSummaryTable) {
                InsertInLayoutUtil.insertToCell(dataSetHandle,table,table.getDetail(),columns,false);
              }
            }
          }
        }
 catch (        Exception e) {
          ExceptionHandler.handle(e);
        }
      }
      if (isSummaryTable) {
        try {
          table.setIsSummaryTable(((Boolean)data[2]).booleanValue());
        }
 catch (        SemanticException e) {
          ExceptionHandler.handle(e);
        }
      }
      return table;
    }
  }
 else {
    TableOptionDialog dialog=new TableOptionDialog(UIUtil.getDefaultShell(),isTable);
    if (dialog.open() == Window.OK && dialog.getResult() instanceof Object[]) {
      Object[] data=(Object[])dialog.getResult();
      DesignElementHandle handle=DesignElementFactory.getInstance().newGridItem(getNewName(extendedData),((Integer)data[1]).intValue(),((Integer)data[0]).intValue());
      InsertInLayoutUtil.setInitWidth(handle);
      return handle;
    }
  }
  return null;
}