Program: 125112
Project: 125112
Buggy source:
public Object[] getChildren(Object parentElement){
  TableNode tableNode=(TableNode)parentElement;
  List<TableNode> child=tableNode.getChildren();
  boolean extended=false;
  if (!child.isEmpty()) {
    for (    TableNode node : child) {
      if (node.getType() == TableNode.COLUMN_FAMILY) {
        extended=true;
        break;
      }
    }
  }
  if (extended) {
    return child.toArray();
  }
  try {
    IMetadataConnection metadataConnection=tableNode.getMetadataConn();
    HBaseAdmin hAdmin=getAdmin(metadataConnection);
    if (tableNode.getType() == TableNode.TABLE) {
      Configuration config=HBaseConfiguration.create();
      config.set("String_Node_Str",metadataConnection.getServerName());
      config.set("String_Node_Str",metadataConnection.getPort());
      HTableDescriptor td=hAdmin.getTableDescriptor(tableNode.getValue().getBytes());
      List<String> familyNames=new ArrayList<String>();
      for (      HColumnDescriptor columnDescripter : td.getColumnFamilies()) {
        String nameAsString=columnDescripter.getNameAsString();
        familyNames.add(nameAsString);
      }
      String columnFamily=metadataConnection.getSchema();
      if (columnFamily == null || "String_Node_Str".equals(columnFamily)) {
        for (        String columnFamilyToAdd : familyNames) {
          TableNode columnFamilyNode=new TableNode();
          columnFamilyNode.setParent(tableNode);
          columnFamilyNode.setType(TableNode.COLUMN_FAMILY);
          columnFamilyNode.setValue(columnFamilyToAdd);
          columnFamilyNode.setItemType(COLUMN_FAMILY);
          columnFamilyNode.setTable(tableNode.getTable());
          columnFamilyNode.setMetadataConn(metadataConnection);
          tableNode.getChildren().add(columnFamilyNode);
        }
      }
 else       if (columnFamily != null && familyNames.contains(columnFamily)) {
        TableNode columnFamilyNode=new TableNode();
        columnFamilyNode.setParent(tableNode);
        columnFamilyNode.setType(TableNode.COLUMN_FAMILY);
        columnFamilyNode.setValue(columnFamily);
        columnFamilyNode.setItemType(COLUMN_FAMILY);
        columnFamilyNode.setTable(tableNode.getTable());
        columnFamilyNode.setMetadataConn(metadataConnection);
        tableNode.getChildren().add(columnFamilyNode);
      }
    }
    if (tableNode.getType() == TableNode.COLUMN_FAMILY) {
      Configuration config=null;
      config=hAdmin.getConfiguration();
      TableNode parent=tableNode.getParent();
      String tableName=null;
      if (parent != null) {
        tableName=parent.getValue();
      }
      org.apache.hadoop.hbase.client.Scan scan=new org.apache.hadoop.hbase.client.Scan();
      org.apache.hadoop.hbase.client.HTable table=new org.apache.hadoop.hbase.client.HTable(config,tableName);
      scan.addFamily(tableNode.getValue().getBytes());
      ResultScanner resultSetscanner=table.getScanner(scan);
      while (resultSetscanner.iterator().hasNext()) {
        Result result=resultSetscanner.iterator().next();
        if (result != null) {
          List<KeyValue> list=result.list();
          if (list != null) {
            List<String> columnExsit=new ArrayList<String>();
            for (            KeyValue kv : list) {
              String columnName=Bytes.toStringBinary(kv.getQualifier());
              String familyName=Bytes.toStringBinary(kv.getFamily());
              String exsistColumn=columnName + "String_Node_Str" + familyName;
              if (!columnExsit.contains(exsistColumn)) {
                TableNode columnNode=new TableNode();
                columnNode.setParent(tableNode);
                columnNode.setType(TableNode.COLUMN);
                columnNode.setValue(Bytes.toStringBinary(kv.getQualifier()));
                columnNode.setItemType("String_Node_Str");
                columnNode.setTable(tableNode.getTable());
                tableNode.getChildren().add(columnNode);
                columnExsit.add(exsistColumn);
              }
            }
            columnExsit=null;
          }
        }
      }
    }
  }
 catch (  MasterNotRunningException e) {
    e.printStackTrace();
  }
catch (  ZooKeeperConnectionException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
  List<TableNode> children=tableNode.getChildren();
  return children.toArray();
}

Fixed version (ground truth):
@Override public Object[] getChildren(Object parentElement){
  TableNode tableNode=(TableNode)parentElement;
  List<TableNode> child=tableNode.getChildren();
  boolean extended=false;
  if (!child.isEmpty()) {
    for (    TableNode node : child) {
      if (node.getType() == TableNode.COLUMN_FAMILY) {
        extended=true;
        break;
      }
    }
  }
  if (extended) {
    return child.toArray();
  }
  try {
    IMetadataConnection metadataConnection=tableNode.getMetadataConn();
    HBaseAdmin hAdmin=getAdmin(metadataConnection);
    if (tableNode.getType() == TableNode.TABLE) {
      Configuration config=HBaseConfiguration.create();
      config.set("String_Node_Str",metadataConnection.getServerName());
      config.set("String_Node_Str",metadataConnection.getPort());
      HTableDescriptor td=hAdmin.getTableDescriptor(tableNode.getValue().getBytes());
      List<String> familyNames=new ArrayList<String>();
      for (      HColumnDescriptor columnDescripter : td.getColumnFamilies()) {
        String nameAsString=columnDescripter.getNameAsString();
        familyNames.add(nameAsString);
      }
      String columnFamily=metadataConnection.getSchema();
      if (columnFamily == null || "String_Node_Str".equals(columnFamily)) {
        for (        String columnFamilyToAdd : familyNames) {
          TableNode columnFamilyNode=new TableNode();
          columnFamilyNode.setParent(tableNode);
          columnFamilyNode.setType(TableNode.COLUMN_FAMILY);
          columnFamilyNode.setValue(columnFamilyToAdd);
          columnFamilyNode.setItemType(COLUMN_FAMILY);
          columnFamilyNode.setTable(tableNode.getTable());
          columnFamilyNode.setMetadataConn(metadataConnection);
          tableNode.getChildren().add(columnFamilyNode);
        }
      }
 else       if (columnFamily != null && familyNames.contains(columnFamily)) {
        TableNode columnFamilyNode=new TableNode();
        columnFamilyNode.setParent(tableNode);
        columnFamilyNode.setType(TableNode.COLUMN_FAMILY);
        columnFamilyNode.setValue(columnFamily);
        columnFamilyNode.setItemType(COLUMN_FAMILY);
        columnFamilyNode.setTable(tableNode.getTable());
        columnFamilyNode.setMetadataConn(metadataConnection);
        tableNode.getChildren().add(columnFamilyNode);
      }
    }
    if (tableNode.getType() == TableNode.COLUMN_FAMILY) {
      Configuration config=null;
      config=hAdmin.getConfiguration();
      TableNode parent=tableNode.getParent();
      String tableName=null;
      if (parent != null) {
        tableName=parent.getValue();
      }
      org.apache.hadoop.hbase.client.Scan scan=new org.apache.hadoop.hbase.client.Scan();
      org.apache.hadoop.hbase.client.HTable table=new org.apache.hadoop.hbase.client.HTable(config,tableName);
      scan.addFamily(tableNode.getValue().getBytes());
      ResultScanner resultSetscanner=table.getScanner(scan);
      while (resultSetscanner.iterator().hasNext()) {
        Result result=resultSetscanner.iterator().next();
        if (result != null) {
          List<KeyValue> list=result.list();
          if (list != null) {
            List<String> columnExsit=new ArrayList<String>();
            for (            KeyValue kv : list) {
              String columnName=Bytes.toStringBinary(kv.getQualifier());
              String familyName=Bytes.toStringBinary(kv.getFamily());
              String exsistColumn=columnName + "String_Node_Str" + familyName;
              if (!columnExsit.contains(exsistColumn)) {
                TableNode columnNode=new TableNode();
                columnNode.setParent(tableNode);
                columnNode.setType(TableNode.COLUMN);
                columnNode.setValue(Bytes.toStringBinary(kv.getQualifier()));
                columnNode.setItemType("String_Node_Str");
                columnNode.setTable(tableNode.getTable());
                tableNode.getChildren().add(columnNode);
                columnExsit.add(exsistColumn);
              }
            }
            columnExsit=null;
          }
        }
      }
    }
  }
 catch (  MasterNotRunningException e) {
    e.printStackTrace();
  }
catch (  ZooKeeperConnectionException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
  List<TableNode> children=tableNode.getChildren();
  return children.toArray();
}