Program: 139399
Project: 139399
Buggy source:
private void createStatisticalSection(Composite topComp){
  statisticalSection=this.createSection(form,topComp,DefaultMessagesImpl.getString("String_Node_Str"),null);
  Composite sectionClient=toolkit.createComposite(statisticalSection);
  sectionClient.setLayout(new GridLayout());
  catalogTableViewer=new TableViewer(sectionClient,SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER| SWT.FULL_SELECTION);
  Table table=catalogTableViewer.getTable();
  table.setHeaderVisible(true);
  table.setBackgroundMode(SWT.INHERIT_FORCE);
  table.setLinesVisible(true);
  GridDataFactory.fillDefaults().align(SWT.FILL,SWT.FILL).grab(true,true).applyTo(table);
  List<TdCatalog> catalogs=getCatalogs();
  boolean containSubSchema=false;
  for (  Catalog catalog : catalogs) {
    List<TdSchema> schemas=CatalogHelper.getSchemas(catalog);
    if (schemas.size() > 0) {
      containSubSchema=true;
      break;
    }
  }
  if (catalogs.size() > 0 && containSubSchema) {
    createCatalogSchemaColumns(table);
    provider=new CatalogSchemaViewerProvier();
    addColumnSorters(catalogTableViewer,catalogTableViewer.getTable().getColumns(),catalogWithSchemaSorters);
    final TableViewer schemaTableViewer=createSecondStatisticalTable(sectionClient);
    schemaTableViewer.addSelectionChangedListener(new DisplayTableAndViewListener());
    catalogTableViewer.addSelectionChangedListener(new ISelectionChangedListener(){
      public void selectionChanged(      SelectionChangedEvent event){
        StructuredSelection selection=(StructuredSelection)event.getSelection();
        CatalogIndicator firstElement=(CatalogIndicator)selection.getFirstElement();
        schemaTableViewer.setInput(firstElement.getSchemaIndicators());
        schemaTableViewer.getTable().setVisible(true);
        addColumnSorters(schemaTableViewer,schemaTableViewer.getTable().getColumns(),schemaSorters);
      }
    }
);
  }
 else {
    if (catalogs.size() > 0) {
      createCatalogTableColumns(table);
      provider=new CatalogViewerProvier();
    }
 else {
      createSchemaTableColumns(table);
      provider=new SchemaViewerProvier();
    }
    addColumnSorters(catalogTableViewer,catalogTableViewer.getTable().getColumns(),schemaSorters);
    catalogTableViewer.addSelectionChangedListener(new DisplayTableAndViewListener());
  }
  catalogTableViewer.setLabelProvider(provider);
  catalogTableViewer.setContentProvider(provider);
  doSetInput();
  tableAndViewComposite=new Composite(sectionClient,SWT.NONE);
  GridDataFactory.fillDefaults().align(SWT.FILL,SWT.FILL).grab(true,true).applyTo(tableAndViewComposite);
  GridLayout layout=new GridLayout(2,false);
  layout.marginWidth=0;
  layout.horizontalSpacing=50;
  tableAndViewComposite.setLayout(layout);
  tableAndViewComposite.setVisible(false);
  sectionClient.layout();
  statisticalSection.setClient(sectionClient);
}

Fixed version (ground truth):
private void createStatisticalSection(Composite topComp){
  statisticalSection=this.createSection(form,topComp,DefaultMessagesImpl.getString("String_Node_Str"),null);
  Composite sectionClient=toolkit.createComposite(statisticalSection);
  sectionClient.setLayout(new GridLayout());
  catalogTableViewer=new TableViewer(sectionClient,SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER| SWT.FULL_SELECTION);
  Table table=catalogTableViewer.getTable();
  table.setHeaderVisible(true);
  table.setBackgroundMode(SWT.INHERIT_FORCE);
  table.setLinesVisible(true);
  GridDataFactory.fillDefaults().align(SWT.FILL,SWT.FILL).grab(true,true).applyTo(table);
  List<TdCatalog> catalogs=getCatalogs();
  boolean containSubSchema=false;
  for (  Catalog catalog : catalogs) {
    List<TdSchema> schemas=CatalogHelper.getSchemas(catalog);
    if (schemas.size() > 0) {
      containSubSchema=true;
      break;
    }
  }
  if (catalogs.size() > 0 && containSubSchema) {
    createCatalogSchemaColumns(table);
    provider=new CatalogSchemaViewerProvier();
    addColumnSorters(catalogTableViewer,catalogTableViewer.getTable().getColumns(),catalogWithSchemaSorters);
    final TableViewer schemaTableViewer=createSecondStatisticalTable(sectionClient);
    schemaTableViewer.addSelectionChangedListener(new DisplayTableAndViewListener());
    catalogTableViewer.addSelectionChangedListener(new ISelectionChangedListener(){
      public void selectionChanged(      SelectionChangedEvent event){
        StructuredSelection selection=(StructuredSelection)event.getSelection();
        CatalogIndicator firstElement=(CatalogIndicator)selection.getFirstElement();
        if (firstElement != null) {
          schemaTableViewer.setInput(firstElement.getSchemaIndicators());
          schemaTableViewer.getTable().setVisible(true);
          addColumnSorters(schemaTableViewer,schemaTableViewer.getTable().getColumns(),schemaSorters);
        }
      }
    }
);
  }
 else {
    if (catalogs.size() > 0) {
      createCatalogTableColumns(table);
      provider=new CatalogViewerProvier();
    }
 else {
      createSchemaTableColumns(table);
      provider=new SchemaViewerProvier();
    }
    addColumnSorters(catalogTableViewer,catalogTableViewer.getTable().getColumns(),schemaSorters);
    catalogTableViewer.addSelectionChangedListener(new DisplayTableAndViewListener());
  }
  catalogTableViewer.setLabelProvider(provider);
  catalogTableViewer.setContentProvider(provider);
  doSetInput();
  tableAndViewComposite=new Composite(sectionClient,SWT.NONE);
  GridDataFactory.fillDefaults().align(SWT.FILL,SWT.FILL).grab(true,true).applyTo(tableAndViewComposite);
  GridLayout layout=new GridLayout(2,false);
  layout.marginWidth=0;
  layout.horizontalSpacing=50;
  tableAndViewComposite.setLayout(layout);
  tableAndViewComposite.setVisible(false);
  sectionClient.layout();
  statisticalSection.setClient(sectionClient);
}