Program: 65381
Project: 65381
Buggy source:
public DesignElementHandle createElement(Object extendedData){
  boolean isTable=ReportDesignConstants.TABLE_ITEM.equals(getElementType());
  TableOptionDialog dialog=new TableOptionDialog(UIUtil.getDefaultShell(),isTable);
  if (dialog.open() == Window.OK && dialog.getResult() instanceof Object[]) {
    Object[] data=(Object[])dialog.getResult();
    DesignElementHandle handle=null;
    if (isTable) {
      boolean isSummaryTable=data.length > 3 && data[3] != null && ((Boolean)data[3]).booleanValue();
      handle=DesignElementFactory.getInstance().newTableItem(getNewName(extendedData),((Integer)data[1]).intValue(),1,isSummaryTable ? 0 : ((Integer)data[0]).intValue(),1);
      if (data[2] != null) {
        try {
          DataSetHandle dataSet=SessionHandleAdapter.getInstance().getReportDesignHandle().findDataSet(data[2].toString());
          ((ReportItemHandle)handle).setDataSet(dataSet);
          DataSetColumnBindingsFormHandleProvider provider=new DataSetColumnBindingsFormHandleProvider();
          provider.setBindingObject((ReportItemHandle)handle);
          provider.generateAllBindingColumns();
        }
 catch (        Exception e) {
          ExceptionHandler.handle(e);
        }
      }
      if (isSummaryTable) {
        try {
          ((TableHandle)handle).setIsSummaryTable(((Boolean)data[3]).booleanValue());
        }
 catch (        SemanticException e) {
          ExceptionHandler.handle(e);
        }
      }
    }
 else {
      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());
  TableOptionDialog dialog=new TableOptionDialog(UIUtil.getDefaultShell(),isTable);
  if (dialog.open() == Window.OK && dialog.getResult() instanceof Object[]) {
    Object[] data=(Object[])dialog.getResult();
    DesignElementHandle handle=null;
    if (isTable) {
      boolean isSummaryTable=data.length > 3 && data[3] != null && ((Boolean)data[3]).booleanValue();
      handle=DesignElementFactory.getInstance().newTableItem(getNewName(extendedData),((Integer)data[1]).intValue(),1,isSummaryTable ? 0 : ((Integer)data[0]).intValue(),1);
      if (data[2] != null) {
        try {
          DataSetHandle dataSet=SessionHandleAdapter.getInstance().getReportDesignHandle().findDataSet(data[2].toString());
          boolean isExtendedDataModel=false;
          if (dataSet == null) {
            ((ReportItemHandle)handle).setDataSet(null);
            isExtendedDataModel=new LinkedDataSetAdapter().setLinkedDataModel((ReportItemHandle)handle,data[2].toString());
          }
          ((ReportItemHandle)handle).setDataSet(dataSet);
          DataSetColumnBindingsFormHandleProvider provider=new DataSetColumnBindingsFormHandleProvider();
          provider.setBindingObject((ReportItemHandle)handle);
          if (!isExtendedDataModel) {
            provider.generateAllBindingColumns();
          }
        }
 catch (        Exception e) {
          ExceptionHandler.handle(e);
        }
      }
      if (isSummaryTable) {
        try {
          ((TableHandle)handle).setIsSummaryTable(((Boolean)data[3]).booleanValue());
        }
 catch (        SemanticException e) {
          ExceptionHandler.handle(e);
        }
      }
    }
 else {
      handle=DesignElementFactory.getInstance().newGridItem(getNewName(extendedData),((Integer)data[1]).intValue(),((Integer)data[0]).intValue());
    }
    InsertInLayoutUtil.setInitWidth(handle);
    return handle;
  }
  return null;
}