Program: 138570
Project: 138570
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) {
    TdReport report=(TdReport)modelElement;
    List<IRepositoryNode> dataprofilingNode=getDataProfilingRepositoryNodes();
    for (    IRepositoryNode patternNode : dataprofilingNode) {
      Item itemTemp=((IRepositoryViewObject)patternNode.getObject()).getProperty().getItem();
      if (itemTemp instanceof TDQReportItem) {
        TDQReportItem item=(TDQReportItem)itemTemp;
        if (ResourceHelper.getUUID(report).equals(ResourceHelper.getUUID(item.getReport()))) {
          return (RepositoryNode)patternNode;
        }
      }
 else       if (itemTemp instanceof FolderItem) {
        List<TDQReportItem> reportItems=getReportItemsFromFolderItem((FolderItem)itemTemp);
        for (        TDQReportItem patternItem : reportItems) {
          if (ResourceHelper.getUUID(report).equals(ResourceHelper.getUUID(patternItem.getReport()))) {
            return (RepositoryNode)patternNode;
          }
        }
      }
    }
  }
 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;
          }
        }
      }
    }
  }
 else   if (modelElement instanceof IndicatorDefinition) {
    IndicatorDefinition udi=(IndicatorDefinition)modelElement;
    List<IRepositoryNode> udisNode=getUdisRepositoryNodes();
    for (    IRepositoryNode udiNode : udisNode) {
      Item itemTemp=((IRepositoryViewObject)udiNode.getObject()).getProperty().getItem();
      if (itemTemp instanceof TDQIndicatorDefinitionItem) {
        TDQIndicatorDefinitionItem item=(TDQIndicatorDefinitionItem)itemTemp;
        if (ResourceHelper.getUUID(udi).equals(ResourceHelper.getUUID(item.getIndicatorDefinition()))) {
          return (RepositoryNode)udiNode;
        }
      }
 else       if (itemTemp instanceof FolderItem) {
        List<TDQIndicatorDefinitionItem> udiItems=getIndicatorItemsFromFolderItem((FolderItem)itemTemp);
        for (        TDQIndicatorDefinitionItem udiItem : udiItems) {
          if (ResourceHelper.getUUID(udi).equals(ResourceHelper.getUUID(udiItem.getIndicatorDefinition()))) {
            return (RepositoryNode)udiNode;
          }
        }
      }
    }
  }
  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) {
    TdReport report=(TdReport)modelElement;
    List<IRepositoryNode> dataprofilingNode=getDataProfilingRepositoryNodes();
    for (    IRepositoryNode patternNode : dataprofilingNode) {
      Item itemTemp=((IRepositoryViewObject)patternNode.getObject()).getProperty().getItem();
      if (itemTemp instanceof TDQReportItem) {
        TDQReportItem item=(TDQReportItem)itemTemp;
        if (ResourceHelper.getUUID(report).equals(ResourceHelper.getUUID(item.getReport()))) {
          return (RepositoryNode)patternNode;
        }
      }
 else       if (itemTemp instanceof FolderItem) {
        List<TDQReportItem> reportItems=getReportItemsFromFolderItem((FolderItem)itemTemp);
        for (        TDQReportItem patternItem : reportItems) {
          if (ResourceHelper.getUUID(report).equals(ResourceHelper.getUUID(patternItem.getReport()))) {
            return (RepositoryNode)patternNode;
          }
        }
      }
    }
  }
 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;
          }
        }
      }
    }
  }
 else   if (modelElement instanceof IndicatorDefinition) {
    IndicatorDefinition udi=(IndicatorDefinition)modelElement;
    List<IRepositoryNode> udisNode=getUdisRepositoryNodes();
    for (    IRepositoryNode udiNode : udisNode) {
      Item itemTemp=((IRepositoryViewObject)udiNode.getObject()).getProperty().getItem();
      if (itemTemp instanceof TDQIndicatorDefinitionItem) {
        TDQIndicatorDefinitionItem item=(TDQIndicatorDefinitionItem)itemTemp;
        if (ResourceHelper.getUUID(udi).equals(ResourceHelper.getUUID(item.getIndicatorDefinition()))) {
          return (RepositoryNode)udiNode;
        }
      }
 else       if (itemTemp instanceof TDQBusinessRuleItem) {
        TDQBusinessRuleItem item=(TDQBusinessRuleItem)itemTemp;
        if (ResourceHelper.getUUID(udi).equals(ResourceHelper.getUUID(item.getDqrule()))) {
          return (RepositoryNode)udiNode;
        }
      }
 else       if (itemTemp instanceof FolderItem) {
        List<TDQIndicatorDefinitionItem> udiItems=getIndicatorItemsFromFolderItem((FolderItem)itemTemp);
        for (        TDQIndicatorDefinitionItem udiItem : udiItems) {
          if (ResourceHelper.getUUID(udi).equals(ResourceHelper.getUUID(udiItem.getIndicatorDefinition()))) {
            return (RepositoryNode)udiNode;
          }
        }
      }
    }
  }
  return null;
}