Program: 128412
Project: 128412
Buggy source:
/** 
 * DOC ocarbone Comment method "initTreeNodes".
 */
private void initTreeNavigatorNodes(){
  List<MetadataTable> tables=ConnectionHelper.getTablesWithOrders(getConnection());
  if (metadataTable == null || tables != null && tables.isEmpty()) {
    if (tables != null && !tables.isEmpty()) {
      boolean isAllDeleted=true;
      for (int i=0; i < tables.size(); i++) {
        if (!TableHelper.isDeleted((MetadataTable)tables.toArray()[i])) {
          metadataTable=(MetadataTable)tables.toArray()[i];
          isAllDeleted=false;
        }
      }
      if (isAllDeleted) {
        addMetadataTable(true);
      }
    }
 else {
      addMetadataTable(false);
    }
  }
  tableNavigator.removeAll();
  List<String> tablenames=new ArrayList<String>();
  for (  MetadataTable t : tables) {
    tablenames.add(t.getLabel());
  }
  String[] allTableLabel=tablenames.toArray(new String[0]);
  Arrays.sort(allTableLabel);
  for (  String element : allTableLabel) {
    if (element.equals(metadataTable.getLabel())) {
      TableItem subItem=new TableItem(tableNavigator,SWT.NONE);
      subItem.setText(element);
      tableNavigator.setSelection(subItem);
    }
 else {
      TableItem subItem=new TableItem(tableNavigator,SWT.NULL);
      subItem.setText(element);
    }
  }
}

Fixed version (ground truth):
/** 
 * DOC ocarbone Comment method "initTreeNodes".
 */
private void initTreeNavigatorNodes(){
  initTables=ConnectionHelper.getTablesWithOrders(getConnection());
  if (metadataTable == null || initTables != null && initTables.isEmpty()) {
    if (initTables != null && !initTables.isEmpty()) {
      boolean isAllDeleted=true;
      for (int i=0; i < initTables.size(); i++) {
        if (!TableHelper.isDeleted((MetadataTable)initTables.toArray()[i])) {
          metadataTable=(MetadataTable)initTables.toArray()[i];
          isAllDeleted=false;
        }
      }
      if (isAllDeleted) {
        addMetadataTable(true);
      }
    }
 else {
      addMetadataTable(false);
    }
  }
  tableNavigator.removeAll();
  List<String> tablenames=new ArrayList<String>();
  for (  MetadataTable t : initTables) {
    tablenames.add(t.getLabel());
  }
  String[] allTableLabel=tablenames.toArray(new String[0]);
  Arrays.sort(allTableLabel);
  if (metadataTable != null && initTables != null && !initTables.isEmpty() && !tablenames.contains(metadataTable.getLabel())) {
    int size=initTables.size();
    if (size >= 1) {
      String tableName=null;
      for (      MetadataTable t : initTables) {
        if (t.getLabel().equals(allTableLabel[0])) {
          tableName=t.getLabel();
          break;
        }
      }
      for (      Object obj : ConnectionHelper.getTables(getConnection())) {
        if (obj instanceof MetadataTable) {
          if (((MetadataTable)obj).getLabel().equals(tableName)) {
            metadataTable=(MetadataTable)obj;
          }
        }
      }
    }
  }
  for (  String element : allTableLabel) {
    if (element.equals(metadataTable.getLabel())) {
      TableItem subItem=new TableItem(tableNavigator,SWT.NONE);
      subItem.setText(element);
      tableNavigator.setSelection(subItem);
    }
 else {
      TableItem subItem=new TableItem(tableNavigator,SWT.NULL);
      subItem.setText(element);
    }
  }
}