Program: 75461
Project: 75461
Buggy source:
private DirectedAcyclicGraph _constructDirectedGraph() throws IllegalActionException {
  DirectedAcyclicGraph dag=new DirectedAcyclicGraph();
  Nameable container=getContainer();
  if (!(container instanceof CompositeActor))   return dag;
  CompositeActor castContainer=(CompositeActor)container;
  Iterator actors=castContainer.deepEntityList().iterator();
  while (actors.hasNext()) {
    dag.addNodeWeight(actors.next());
  }
  actors=castContainer.deepEntityList().iterator();
  while (actors.hasNext()) {
    Actor actor=(Actor)actors.next();
    IODependence ioDependence=actor.getIODependence();
    Iterator ports=actor.inputPortList().iterator();
    while (ports.hasNext()) {
      IOPort inputPort=(IOPort)ports.next();
      List delayPorts=null;
      if (ioDependence != null) {
        IOInformation ioInfo=ioDependence.getInputPort(inputPort);
        delayPorts=ioInfo.getDelayToPorts();
      }
      Iterator triggers=actor.outputPortList().iterator();
      while (triggers.hasNext()) {
        IOPort outPort=(IOPort)triggers.next();
        if (delayPorts != null && delayPorts.contains(outPort)) {
          continue;
        }
        Iterator inPortIterator=outPort.deepConnectedInPortList().iterator();
        int referenceDepth=outPort.depthInHierarchy();
        while (inPortIterator.hasNext()) {
          IOPort port=(IOPort)inPortIterator.next();
          if (port.depthInHierarchy() < referenceDepth) {
            if (((NamedObj)port.getContainer()).deepContains(outPort)) {
              continue;
            }
          }
          Actor destination=(Actor)(port.getContainer());
          if (destination.equals(actor)) {
            List directFeedthroughOutputs=null;
            if (ioDependence != null) {
              directFeedthroughOutputs=ioDependence.getInputPort(port).getDirectFeedthroughPorts();
            }
 else {
              directFeedthroughOutputs=destination.outputPortList();
            }
            if (directFeedthroughOutputs.contains(port)) {
              throw new IllegalActionException(this,"String_Node_Str" + ((Nameable)actor).getFullName());
            }
          }
          if (dag.containsNodeWeight(destination)) {
            dag.addEdge(actor,destination);
          }
 else {
            throw new IllegalActionException(this,"String_Node_Str" + ((Nameable)actor).getFullName() + "String_Node_Str"+ ((Nameable)destination).getFullName());
          }
        }
      }
    }
  }
  if (!dag.isAcyclic()) {
    Object[] cycleNodes=dag.cycleNodes();
    StringBuffer names=new StringBuffer();
    for (int i=0; i < cycleNodes.length; i++) {
      if (cycleNodes[i] instanceof Nameable) {
        if (i > 0)         names.append("String_Node_Str");
        names.append(((Nameable)cycleNodes[i]).getFullName());
      }
    }
    throw new IllegalActionException(this,"String_Node_Str" + names.toString());
  }
  return dag;
}

Fixed version (ground truth):
private DirectedAcyclicGraph _constructDirectedGraph() throws IllegalActionException {
  DirectedAcyclicGraph dag=new DirectedAcyclicGraph();
  Nameable container=getContainer();
  if (!(container instanceof CompositeActor))   return dag;
  CompositeActor castContainer=(CompositeActor)container;
  Iterator actors=castContainer.deepEntityList().iterator();
  while (actors.hasNext()) {
    dag.addNodeWeight(actors.next());
  }
  actors=castContainer.deepEntityList().iterator();
  while (actors.hasNext()) {
    Actor actor=(Actor)actors.next();
    IODependence ioDependence=actor.getIODependence();
    Iterator ports=actor.inputPortList().iterator();
    while (ports.hasNext()) {
      IOPort inputPort=(IOPort)ports.next();
      List delayPorts=null;
      if (ioDependence != null) {
        IOInformation ioInfo=ioDependence.getInputPort(inputPort);
        delayPorts=ioInfo.getDelayToPorts();
      }
      Iterator triggers=actor.outputPortList().iterator();
      while (triggers.hasNext()) {
        IOPort outPort=(IOPort)triggers.next();
        if (delayPorts != null && delayPorts.contains(outPort)) {
          continue;
        }
        Iterator inPortIterator=outPort.deepConnectedInPortList().iterator();
        int referenceDepth=outPort.depthInHierarchy();
        while (inPortIterator.hasNext()) {
          IOPort port=(IOPort)inPortIterator.next();
          if (port.depthInHierarchy() < referenceDepth) {
            if (((NamedObj)port.getContainer()).deepContains(outPort)) {
              continue;
            }
          }
          Actor destination=(Actor)(port.getContainer());
          if (destination.equals(actor)) {
            List directFeedthroughOutputs=null;
            if (ioDependence != null) {
              directFeedthroughOutputs=ioDependence.getInputPort(port).getDirectFeedthroughPorts();
            }
 else {
              directFeedthroughOutputs=destination.outputPortList();
            }
            if (directFeedthroughOutputs.contains(outPort)) {
              throw new IllegalActionException(this,"String_Node_Str" + ((Nameable)actor).getFullName());
            }
          }
          if (dag.containsNodeWeight(destination)) {
            dag.addEdge(actor,destination);
          }
 else {
            throw new IllegalActionException(this,"String_Node_Str" + ((Nameable)actor).getFullName() + "String_Node_Str"+ ((Nameable)destination).getFullName());
          }
        }
      }
    }
  }
  if (!dag.isAcyclic()) {
    Object[] cycleNodes=dag.cycleNodes();
    StringBuffer names=new StringBuffer();
    for (int i=0; i < cycleNodes.length; i++) {
      if (cycleNodes[i] instanceof Nameable) {
        if (i > 0)         names.append("String_Node_Str");
        names.append(((Nameable)cycleNodes[i]).getFullName());
      }
    }
    throw new IllegalActionException(this,"String_Node_Str" + names.toString());
  }
  return dag;
}