Program: 126364
Project: 126364
Buggy source:
private static void checkItemDependencies(Item item,List<IRepositoryViewObject> repositoryObjects){
  if (item == null) {
    return;
  }
  IProxyRepositoryFactory factory=CorePlugin.getDefault().getProxyRepositoryFactory();
  RelationshipItemBuilder builder=RelationshipItemBuilder.getInstance();
  List<Relation> relations=builder.getItemsRelatedTo(item.getProperty().getId(),item.getProperty().getVersion(),RelationshipItemBuilder.JOB_RELATION);
  for (  Relation relation : relations) {
    IRepositoryViewObject obj=null;
    try {
      if (RelationshipItemBuilder.MAPPER_RELATION.equals(relation.getType())) {
        IRepositoryViewObject mapperObj=factory.getLastVersion(relation.getId());
        if (mapperObj != null) {
          if (!repositoryObjects.contains(mapperObj)) {
            repositoryObjects.add(mapperObj);
          }
          for (          IExtendedRepositoryNodeHandler nodeHandler : RepositoryContentManager.getExtendedNodeHandler()) {
            List<IRepositoryViewObject> nodesAndDependencies=nodeHandler.getRepositoryObjectDependencies(mapperObj);
            for (            IRepositoryViewObject refObject : nodesAndDependencies) {
              if (!repositoryObjects.contains(refObject)) {
                repositoryObjects.add(refObject);
              }
            }
          }
        }
      }
 else       if (RelationshipItemBuilder.ROUTINE_RELATION.equals(relation.getType())) {
        obj=RoutinesUtil.getRoutineFromName(relation.getId());
      }
 else {
        obj=factory.getLastVersion(relation.getId());
      }
      if (obj != null) {
        if (!repositoryObjects.contains(obj)) {
          repositoryObjects.add(obj);
          checkAllVerSionLatest(repositoryObjects,obj);
          checkItemDependencies(obj.getProperty().getItem(),repositoryObjects);
        }
      }
    }
 catch (    PersistenceException et) {
      ExceptionHandler.process(et);
    }
  }
}

Fixed version (ground truth):
private static void checkItemDependencies(Item item,List<IRepositoryViewObject> repositoryObjects){
  if (item == null) {
    return;
  }
  IProxyRepositoryFactory factory=CorePlugin.getDefault().getProxyRepositoryFactory();
  RelationshipItemBuilder builder=RelationshipItemBuilder.getInstance();
  List<Relation> relations=builder.getItemsRelatedTo(item.getProperty().getId(),item.getProperty().getVersion(),RelationshipItemBuilder.JOB_RELATION);
  for (  Relation relation : relations) {
    IRepositoryViewObject obj=null;
    try {
      if (RelationshipItemBuilder.MAPPER_RELATION.equals(relation.getType())) {
        IRepositoryViewObject mapperObj=factory.getLastVersion(relation.getId());
        if (mapperObj != null) {
          if (!repositoryObjects.contains(mapperObj)) {
            repositoryObjects.add(mapperObj);
          }
          for (          IExtendedRepositoryNodeHandler nodeHandler : RepositoryContentManager.getExtendedNodeHandler()) {
            List<IRepositoryViewObject> nodesAndDependencies=nodeHandler.getRepositoryObjectDependencies(mapperObj);
            for (            IRepositoryViewObject refObject : nodesAndDependencies) {
              if (!repositoryObjects.contains(refObject)) {
                repositoryObjects.add(refObject);
              }
            }
          }
        }
      }
 else       if (RelationshipItemBuilder.ROUTINE_RELATION.equals(relation.getType())) {
        obj=RoutinesUtil.getRoutineFromName(relation.getId());
      }
 else {
        obj=factory.getLastVersion(relation.getId());
      }
      if (obj != null) {
        updateRepositoryObjects(repositoryObjects,obj);
        IRepositoryViewObject clusterObj=getHadoopClusterConnectionIfNeeded(obj,factory);
        if (clusterObj != null) {
          updateRepositoryObjects(repositoryObjects,clusterObj);
        }
      }
    }
 catch (    PersistenceException et) {
      ExceptionHandler.process(et);
    }
  }
}