Program: 127571
Project: 127571
Buggy source:
/** 
 * wzhang Comment method "isExistTable".
 * @param tableNode
 * @return
 */
private boolean isExistTable(TableNode tableNode){
  if (tableNode != null && tableNode.getType() == TableNode.TABLE) {
    TableNode parent=tableNode.getParent();
    if (parent == null) {
      for (      Object obj : ConnectionHelper.getTables(getConnection())) {
        if (obj == null) {
          continue;
        }
        MetadataTable table=(MetadataTable)obj;
        if (table.getLabel().equals(tableNode.getValue())) {
          return true;
        }
      }
    }
 else {
      int type=parent.getType();
      EList<ModelElement> ownedElement=null;
      if (type == TableNode.CATALOG) {
        Catalog c=(Catalog)ConnectionHelper.getPackage(parent.getValue(),getConnection(),Catalog.class);
        if (c != null) {
          ownedElement=c.getOwnedElement();
        }
      }
 else       if (type == TableNode.SCHEMA) {
        TableNode p=parent.getParent();
        Schema s=null;
        if (p == null) {
          s=(Schema)ConnectionHelper.getPackage(parent.getValue(),getConnection(),Schema.class);
        }
 else {
          Catalog c=(Catalog)ConnectionHelper.getPackage(p.getValue(),getConnection(),Catalog.class);
          if (c != null) {
            List<Schema> schemas=CatalogHelper.getSchemas(c);
            for (            Schema schema : schemas) {
              if (schema.getName().equals(parent.getValue())) {
                s=schema;
                break;
              }
            }
          }
        }
        if (s != null) {
          ownedElement=s.getOwnedElement();
        }
      }
      if (ownedElement != null) {
        for (        ModelElement m : ownedElement) {
          if (m instanceof MetadataTable) {
            String label=((MetadataTable)m).getLabel();
            if (label.equals(tableNode.getValue())) {
              return true;
            }
          }
        }
      }
 else {
        for (        Object obj : ConnectionHelper.getTables(getConnection())) {
          if (obj == null) {
            continue;
          }
          MetadataTable table=(MetadataTable)obj;
          if (table.getLabel().equals(tableNode.getValue())) {
            return true;
          }
        }
      }
    }
  }
 else   if (useProvider()) {
    return provider.isMetadataExsit(tableNode,getConnection());
  }
  return false;
}

Fixed version (ground truth):
/** 
 * wzhang Comment method "isExistTable".
 * @param tableNode
 * @return
 */
private boolean isExistTable(TableNode tableNode){
  if (tableNode != null && tableNode.getType() == TableNode.TABLE) {
    TableNode parent=tableNode.getParent();
    if (parent == null) {
      for (      Object obj : ConnectionHelper.getTables(getConnection())) {
        if (obj == null) {
          continue;
        }
        MetadataTable table=(MetadataTable)obj;
        if (table.getLabel().equals(tableNode.getValue())) {
          return true;
        }
      }
    }
 else {
      int type=parent.getType();
      EList<ModelElement> ownedElement=null;
      if (type == TableNode.CATALOG) {
        Catalog c=(Catalog)ConnectionHelper.getPackage(parent.getValue(),getConnection(),Catalog.class);
        if (c != null) {
          ownedElement=c.getOwnedElement();
        }
      }
 else       if (type == TableNode.SCHEMA) {
        TableNode p=parent.getParent();
        Schema s=null;
        if (p == null) {
          s=(Schema)ConnectionHelper.getPackage(parent.getValue(),getConnection(),Schema.class);
        }
 else {
          Catalog c=(Catalog)ConnectionHelper.getPackage(p.getValue(),getConnection(),Catalog.class);
          if (c != null) {
            List<Schema> schemas=CatalogHelper.getSchemas(c);
            for (            Schema schema : schemas) {
              if (schema.getName().equals(parent.getValue())) {
                s=schema;
                break;
              }
            }
          }
        }
        if (s != null) {
          ownedElement=s.getOwnedElement();
        }
      }
      if (ownedElement != null) {
        for (        ModelElement m : ownedElement) {
          if (m instanceof MetadataTable) {
            String label=((MetadataTable)m).getName();
            if (label.equals(tableNode.getValue())) {
              return true;
            }
          }
        }
      }
 else {
        for (        Object obj : ConnectionHelper.getTables(getConnection())) {
          if (obj == null) {
            continue;
          }
          MetadataTable table=(MetadataTable)obj;
          if (table.getLabel().equals(tableNode.getValue())) {
            return true;
          }
        }
      }
    }
  }
 else   if (useProvider()) {
    return provider.isMetadataExsit(tableNode,getConnection());
  }
  return false;
}