Program: 128060
Project: 128060
Buggy source:
/** 
 * 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);
    }
  }
}

Fixed version (ground truth):
/** 
 * DOC ocarbone Comment method "initTreeNodes".
 */
private void initTreeNavigatorNodes(){
  initTables=ConnectionHelper.getTablesWithOrders(getConnection());
  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);
    }
  }
}