Program: 138548
Project: 138548
Buggy source:
public static RepositoryNode recursiveFind(ModelElement modelElement){
  if (modelElement instanceof Analysis) {
    Analysis analysis=(Analysis)modelElement;
    List<IRepositoryNode> dataprofilingNode=getDataProfilingRepositoryNodes();
    for (    IRepositoryNode anaNode : dataprofilingNode) {
      Item itemTemp=((IRepositoryViewObject)anaNode.getObject()).getProperty().getItem();
      if (itemTemp instanceof TDQAnalysisItem) {
        TDQAnalysisItem item=(TDQAnalysisItem)itemTemp;
        if (ResourceHelper.getUUID(analysis).equals(ResourceHelper.getUUID(item.getAnalysis()))) {
          return (RepositoryNode)anaNode;
        }
      }
 else       if (itemTemp instanceof FolderItem) {
        List<TDQAnalysisItem> anaItems=getAnalysisItemsFromFolderItem((FolderItem)itemTemp);
        for (        TDQAnalysisItem anaItem : anaItems) {
          if (ResourceHelper.getUUID(analysis).equals(ResourceHelper.getUUID(anaItem.getAnalysis()))) {
            return (RepositoryNode)anaNode;
          }
        }
      }
    }
  }
 else   if (modelElement instanceof TdReport) {
  }
 else   if (modelElement instanceof TdColumn) {
    TdColumn column=(TdColumn)modelElement;
    IRepositoryNode columnSetNode=recursiveFind(ColumnHelper.getColumnOwnerAsColumnSet(column));
    for (    IRepositoryNode columnNode : columnSetNode.getChildren().get(0).getChildren()) {
      TdColumn columnOnUI=(TdColumn)((MetadataColumnRepositoryObject)columnNode.getObject()).getTdColumn();
      if (ResourceHelper.getUUID(column).equals(ResourceHelper.getUUID(columnOnUI))) {
        return (RepositoryNode)columnNode;
      }
    }
  }
 else   if (modelElement instanceof TdTable) {
    TdTable table=(TdTable)modelElement;
    IRepositoryNode schemaOrCatalogNode=recursiveFind(ColumnSetHelper.getParentCatalogOrSchema(modelElement));
    for (    IRepositoryNode tableNode : schemaOrCatalogNode.getChildren().get(0).getChildren()) {
      TdTable tableOnUI=(TdTable)((TdTableRepositoryObject)tableNode.getObject()).getTdTable();
      if (ResourceHelper.getUUID(table).equals(ResourceHelper.getUUID(tableOnUI))) {
        return (RepositoryNode)tableNode;
      }
    }
  }
 else   if (modelElement instanceof TdView) {
    TdView view=(TdView)modelElement;
    IRepositoryNode schemaOrCatalogNode=recursiveFind(ColumnSetHelper.getParentCatalogOrSchema(modelElement));
    for (    IRepositoryNode viewNode : schemaOrCatalogNode.getChildren().get(1).getChildren()) {
      TdView viewOnUI=(TdView)((TdViewRepositoryObject)viewNode.getObject()).getTdView();
      if (ResourceHelper.getUUID(view).equals(ResourceHelper.getUUID(viewOnUI))) {
        return (RepositoryNode)viewNode;
      }
    }
  }
 else   if (modelElement instanceof MetadataColumn) {
    MetadataColumn column=(MetadataColumn)modelElement;
    IRepositoryNode columnSetNode=recursiveFind(ColumnHelper.getColumnOwnerAsMetadataTable(column));
    for (    IRepositoryNode columnNode : columnSetNode.getChildren().get(0).getChildren()) {
      MetadataColumn columnOnUI=((MetadataColumnRepositoryObject)columnNode.getObject()).getTdColumn();
      if (ResourceHelper.getUUID(column).equals(ResourceHelper.getUUID(columnOnUI))) {
        return (RepositoryNode)columnNode;
      }
    }
  }
 else   if (modelElement instanceof MetadataTable) {
    MetadataTable table=(MetadataTable)modelElement;
    if (table.getNamespace() instanceof RecordFile) {
      IRepositoryNode connNode=recursiveFind(ConnectionHelper.getTdDataProvider(table));
      for (      IRepositoryNode tableNode : connNode.getChildren()) {
        MetadataTable tableOnUI=(MetadataTable)((MetadataTableRepositoryObject)tableNode.getObject()).getTable();
        if (ResourceHelper.getUUID(table).equals(ResourceHelper.getUUID(tableOnUI))) {
          return (RepositoryNode)tableNode;
        }
      }
    }
  }
 else   if (modelElement instanceof Catalog) {
    Catalog catalog=(Catalog)modelElement;
    IRepositoryNode connNode=recursiveFind(ConnectionHelper.getTdDataProvider(catalog));
    for (    IRepositoryNode catalogNode : connNode.getChildren()) {
      Catalog catalogOnUI=((MetadataCatalogRepositoryObject)catalogNode.getObject()).getCatalog();
      if (ResourceHelper.getUUID(catalog).equals(ResourceHelper.getUUID(catalogOnUI))) {
        return (RepositoryNode)catalogNode;
      }
    }
  }
 else   if (modelElement instanceof Schema) {
    Schema schema=(Schema)modelElement;
    Catalog catalog=CatalogHelper.getParentCatalog(schema);
    if (catalog != null) {
      IRepositoryNode catalogNode=recursiveFind(catalog);
      for (      IRepositoryNode schemaNode : catalogNode.getChildren()) {
        Schema schemaOnUI=((MetadataSchemaRepositoryObject)schemaNode.getObject()).getSchema();
        if (ResourceHelper.getUUID(schema).equals(ResourceHelper.getUUID(schemaOnUI))) {
          return (RepositoryNode)schemaNode;
        }
      }
    }
    IRepositoryNode connNode=recursiveFind(ConnectionHelper.getTdDataProvider(schema));
    for (    IRepositoryNode schemaNode : connNode.getChildren()) {
      Schema schemaOnUI=((MetadataSchemaRepositoryObject)schemaNode.getObject()).getSchema();
      if (ResourceHelper.getUUID(schema).equals(ResourceHelper.getUUID(schemaOnUI))) {
        return (RepositoryNode)schemaNode;
      }
    }
  }
 else   if (modelElement instanceof Connection) {
    Connection connection=(Connection)modelElement;
    List<IRepositoryNode> connsNode=getConnectionRepositoryNodes();
    for (    IRepositoryNode connNode : connsNode) {
      Item itemTemp=((IRepositoryViewObject)connNode.getObject()).getProperty().getItem();
      if (itemTemp instanceof ConnectionItem) {
        ConnectionItem item=(ConnectionItem)itemTemp;
        if (ResourceHelper.getUUID(connection).equals(ResourceHelper.getUUID(item.getConnection()))) {
          return (RepositoryNode)connNode;
        }
      }
 else       if (itemTemp instanceof FolderItem) {
        List<ConnectionItem> connItems=getConnectionItemsFromFolderItem((FolderItem)itemTemp);
        for (        ConnectionItem connItem : connItems) {
          if (ResourceHelper.getUUID(connection).equals(ResourceHelper.getUUID(connItem.getConnection()))) {
            return (RepositoryNode)connNode;
          }
        }
      }
    }
  }
  return null;
}

Fixed version (ground truth):
public static RepositoryNode recursiveFind(ModelElement modelElement){
  if (modelElement instanceof Analysis) {
    Analysis analysis=(Analysis)modelElement;
    List<IRepositoryNode> dataprofilingNode=getDataProfilingRepositoryNodes();
    for (    IRepositoryNode anaNode : dataprofilingNode) {
      Item itemTemp=((IRepositoryViewObject)anaNode.getObject()).getProperty().getItem();
      if (itemTemp instanceof TDQAnalysisItem) {
        TDQAnalysisItem item=(TDQAnalysisItem)itemTemp;
        if (ResourceHelper.getUUID(analysis).equals(ResourceHelper.getUUID(item.getAnalysis()))) {
          return (RepositoryNode)anaNode;
        }
      }
 else       if (itemTemp instanceof FolderItem) {
        List<TDQAnalysisItem> anaItems=getAnalysisItemsFromFolderItem((FolderItem)itemTemp);
        for (        TDQAnalysisItem anaItem : anaItems) {
          if (ResourceHelper.getUUID(analysis).equals(ResourceHelper.getUUID(anaItem.getAnalysis()))) {
            return (RepositoryNode)anaNode;
          }
        }
      }
    }
  }
 else   if (modelElement instanceof TdReport) {
  }
 else   if (modelElement instanceof TdColumn) {
    TdColumn column=(TdColumn)modelElement;
    IRepositoryNode columnSetNode=recursiveFind(ColumnHelper.getColumnOwnerAsColumnSet(column));
    for (    IRepositoryNode columnNode : columnSetNode.getChildren().get(0).getChildren()) {
      TdColumn columnOnUI=(TdColumn)((MetadataColumnRepositoryObject)columnNode.getObject()).getTdColumn();
      if (ResourceHelper.getUUID(column).equals(ResourceHelper.getUUID(columnOnUI))) {
        return (RepositoryNode)columnNode;
      }
    }
  }
 else   if (modelElement instanceof TdTable) {
    TdTable table=(TdTable)modelElement;
    IRepositoryNode schemaOrCatalogNode=recursiveFind(ColumnSetHelper.getParentCatalogOrSchema(modelElement));
    for (    IRepositoryNode tableNode : schemaOrCatalogNode.getChildren().get(0).getChildren()) {
      TdTable tableOnUI=(TdTable)((TdTableRepositoryObject)tableNode.getObject()).getTdTable();
      if (ResourceHelper.getUUID(table).equals(ResourceHelper.getUUID(tableOnUI))) {
        return (RepositoryNode)tableNode;
      }
    }
  }
 else   if (modelElement instanceof TdView) {
    TdView view=(TdView)modelElement;
    IRepositoryNode schemaOrCatalogNode=recursiveFind(ColumnSetHelper.getParentCatalogOrSchema(modelElement));
    for (    IRepositoryNode viewNode : schemaOrCatalogNode.getChildren().get(1).getChildren()) {
      TdView viewOnUI=(TdView)((TdViewRepositoryObject)viewNode.getObject()).getTdView();
      if (ResourceHelper.getUUID(view).equals(ResourceHelper.getUUID(viewOnUI))) {
        return (RepositoryNode)viewNode;
      }
    }
  }
 else   if (modelElement instanceof MetadataColumn) {
    MetadataColumn column=(MetadataColumn)modelElement;
    IRepositoryNode columnSetNode=recursiveFind(ColumnHelper.getColumnOwnerAsMetadataTable(column));
    for (    IRepositoryNode columnNode : columnSetNode.getChildren().get(0).getChildren()) {
      MetadataColumn columnOnUI=((MetadataColumnRepositoryObject)columnNode.getObject()).getTdColumn();
      if (ResourceHelper.getUUID(column).equals(ResourceHelper.getUUID(columnOnUI))) {
        return (RepositoryNode)columnNode;
      }
    }
  }
 else   if (modelElement instanceof MetadataTable) {
    MetadataTable table=(MetadataTable)modelElement;
    if (table.getNamespace() instanceof RecordFile) {
      IRepositoryNode connNode=recursiveFind(ConnectionHelper.getTdDataProvider(table));
      for (      IRepositoryNode tableNode : connNode.getChildren()) {
        MetadataTable tableOnUI=(MetadataTable)((MetadataTableRepositoryObject)tableNode.getObject()).getTable();
        if (ResourceHelper.getUUID(table).equals(ResourceHelper.getUUID(tableOnUI))) {
          return (RepositoryNode)tableNode;
        }
      }
    }
  }
 else   if (modelElement instanceof Catalog) {
    Catalog catalog=(Catalog)modelElement;
    IRepositoryNode connNode=recursiveFind(ConnectionHelper.getTdDataProvider(catalog));
    for (    IRepositoryNode catalogNode : connNode.getChildren()) {
      Catalog catalogOnUI=((MetadataCatalogRepositoryObject)catalogNode.getObject()).getCatalog();
      if (ResourceHelper.getUUID(catalog).equals(ResourceHelper.getUUID(catalogOnUI))) {
        return (RepositoryNode)catalogNode;
      }
    }
  }
 else   if (modelElement instanceof Schema) {
    Schema schema=(Schema)modelElement;
    Catalog catalog=CatalogHelper.getParentCatalog(schema);
    if (catalog != null) {
      IRepositoryNode catalogNode=recursiveFind(catalog);
      for (      IRepositoryNode schemaNode : catalogNode.getChildren()) {
        Schema schemaOnUI=((MetadataSchemaRepositoryObject)schemaNode.getObject()).getSchema();
        if (ResourceHelper.getUUID(schema).equals(ResourceHelper.getUUID(schemaOnUI))) {
          return (RepositoryNode)schemaNode;
        }
      }
    }
    IRepositoryNode connNode=recursiveFind(ConnectionHelper.getTdDataProvider(schema));
    for (    IRepositoryNode schemaNode : connNode.getChildren()) {
      Schema schemaOnUI=((MetadataSchemaRepositoryObject)schemaNode.getObject()).getSchema();
      if (ResourceHelper.getUUID(schema).equals(ResourceHelper.getUUID(schemaOnUI))) {
        return (RepositoryNode)schemaNode;
      }
    }
  }
 else   if (modelElement instanceof Connection) {
    Connection connection=(Connection)modelElement;
    List<IRepositoryNode> connsNode=getConnectionRepositoryNodes();
    for (    IRepositoryNode connNode : connsNode) {
      Item itemTemp=((IRepositoryViewObject)connNode.getObject()).getProperty().getItem();
      if (itemTemp instanceof ConnectionItem) {
        ConnectionItem item=(ConnectionItem)itemTemp;
        if (ResourceHelper.getUUID(connection).equals(ResourceHelper.getUUID(item.getConnection()))) {
          return (RepositoryNode)connNode;
        }
      }
 else       if (itemTemp instanceof FolderItem) {
        List<ConnectionItem> connItems=getConnectionItemsFromFolderItem((FolderItem)itemTemp);
        for (        ConnectionItem connItem : connItems) {
          if (ResourceHelper.getUUID(connection).equals(ResourceHelper.getUUID(connItem.getConnection()))) {
            return (RepositoryNode)connNode;
          }
        }
      }
    }
  }
 else   if (modelElement instanceof Pattern) {
    Pattern pattern=(Pattern)modelElement;
    List<IRepositoryNode> patternsNode=getPatternsRepositoryNodes();
    for (    IRepositoryNode patternNode : patternsNode) {
      Item itemTemp=((IRepositoryViewObject)patternNode.getObject()).getProperty().getItem();
      if (itemTemp instanceof TDQPatternItem) {
        TDQPatternItem item=(TDQPatternItem)itemTemp;
        if (ResourceHelper.getUUID(pattern).equals(ResourceHelper.getUUID(item.getPattern()))) {
          return (RepositoryNode)patternNode;
        }
      }
 else       if (itemTemp instanceof FolderItem) {
        List<TDQPatternItem> patternItems=getPatternsItemsFromFolderItem((FolderItem)itemTemp);
        for (        TDQPatternItem patternItem : patternItems) {
          if (ResourceHelper.getUUID(pattern).equals(ResourceHelper.getUUID(patternItem.getPattern()))) {
            return (RepositoryNode)patternNode;
          }
        }
      }
    }
  }
  return null;
}