Program: 138748
Project: 138748
Buggy source:
private ModelElement findMatchedModelElement(EObject parent,EObject similarElement){
  if (parent instanceof Connection) {
    if (similarElement instanceof Schema) {
      if (selectedOjbect instanceof Catalog) {
        List<Schema> schemas=CatalogHelper.getSchemas((Catalog)selectedOjbect);
        if (schemas != null && schemas.size() > 0) {
          for (          Schema tdSchema : schemas) {
            if (tdSchema.getName().equalsIgnoreCase(((Schema)similarElement).getName())) {
              return tdSchema;
            }
          }
        }
      }
      List<Schema> schames=ConnectionHelper.getSchema((Connection)parent);
      for (      Schema schame : schames) {
        if (schame.getName().equalsIgnoreCase(((Schema)similarElement).getName())) {
          return schame;
        }
      }
    }
    if (similarElement instanceof Catalog) {
      List<Catalog> catalogs=ConnectionHelper.getCatalogs((Connection)parent);
      for (      Catalog catalog : catalogs) {
        if (catalog.getName().equalsIgnoreCase(((Catalog)similarElement).getName())) {
          return catalog;
        }
      }
    }
  }
 else   if (parent instanceof Package) {
    List<ColumnSet> columnSets=new ArrayList<ColumnSet>();
    columnSets.addAll(PackageHelper.getTables((Package)parent));
    columnSets.addAll(PackageHelper.getViews((Package)parent));
    for (    ModelElement columnSet : columnSets) {
      if (((ColumnSet)columnSet).getName().equalsIgnoreCase(((ColumnSet)similarElement).getName())) {
        return columnSet;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
private ModelElement findMatchedModelElement(EObject parent,EObject similarElement){
  if (parent instanceof Connection) {
    if (similarElement instanceof Schema) {
      if (selectedOjbect instanceof Catalog) {
        List<Schema> schemas=CatalogHelper.getSchemas((Catalog)selectedOjbect);
        if (schemas != null && schemas.size() > 0) {
          for (          Schema tdSchema : schemas) {
            if (tdSchema.getName().equalsIgnoreCase(((Schema)similarElement).getName())) {
              return tdSchema;
            }
          }
        }
      }
      List<Schema> schames=ConnectionHelper.getSchema((Connection)parent);
      for (      Schema schame : schames) {
        if (schame.getName().equalsIgnoreCase(((Schema)similarElement).getName())) {
          return schame;
        }
      }
    }
    if (similarElement instanceof Catalog) {
      List<Catalog> catalogs=ConnectionHelper.getCatalogs((Connection)parent);
      for (      Catalog catalog : catalogs) {
        if (catalog.getName().equalsIgnoreCase(((Catalog)similarElement).getName())) {
          return catalog;
        }
      }
    }
  }
 else   if (parent instanceof Package) {
    if (parent != null && parent.eIsProxy()) {
      parent=EObjectHelper.resolveObject(parent);
    }
    List<ColumnSet> columnSets=new ArrayList<ColumnSet>();
    columnSets.addAll(PackageHelper.getTables((Package)parent));
    columnSets.addAll(PackageHelper.getViews((Package)parent));
    for (    ModelElement columnSet : columnSets) {
      if (((ColumnSet)columnSet).getName().equalsIgnoreCase(((ColumnSet)similarElement).getName())) {
        return columnSet;
      }
    }
  }
  return null;
}