Program: 76389
Project: 76389
Buggy source:
private void _constructDirectedGraph(){
  LinkedList portList=new LinkedList();
  _dag=new DirectedAcyclicGraph();
  CompositeActor container=((CompositeActor)getContainer());
  if (container != null) {
    Enumeration allactors=container.deepGetEntities();
    while (allactors.hasMoreElements()) {
      Actor actor=(Actor)allactors.nextElement();
      Enumeration allports=actor.inputPorts();
      while (allports.hasMoreElements()) {
        IOPort port=(IOPort)allports.nextElement();
        _dag.add(port);
        portList.insertLast(port);
      }
    }
  }
  Enumeration copiedPorts=portList.elements();
  while (copiedPorts.hasMoreElements()) {
    IOPort ioPort=(IOPort)copiedPorts.nextElement();
    if (ioPort instanceof DEIOPort) {
      DEIOPort p=(DEIOPort)ioPort;
      Enumeration befores=p.beforePorts();
      while (befores.hasMoreElements()) {
        IOPort after=(IOPort)befores.nextElement();
        if (_dag.contains(after)) {
          _dag.addEdge(p,after);
        }
 else {
          throw new InternalErrorException("String_Node_Str");
        }
      }
      Enumeration triggers=p.triggersPorts();
      while (triggers.hasMoreElements()) {
        IOPort outPort=(IOPort)triggers.nextElement();
        Enumeration inPortEnum=outPort.deepConnectedInPorts();
        while (inPortEnum.hasMoreElements()) {
          IOPort pp=(IOPort)inPortEnum.nextElement();
          if (_dag.contains(pp)) {
            _dag.addEdge(p,pp);
          }
 else {
            throw new InternalErrorException("String_Node_Str");
          }
        }
      }
    }
 else {
      Enumeration triggers=((Actor)ioPort.getContainer()).outputPorts();
      while (triggers.hasMoreElements()) {
        IOPort outPort=(IOPort)triggers.nextElement();
        Enumeration inPortEnum=outPort.deepConnectedInPorts();
        while (inPortEnum.hasMoreElements()) {
          IOPort pp=(IOPort)inPortEnum.nextElement();
          if (_dag.contains(pp)) {
            _dag.addEdge(ioPort,pp);
          }
 else {
            throw new InternalErrorException("String_Node_Str");
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
private DirectedAcyclicGraph _constructDirectedGraph() throws IllegalActionException {
  LinkedList portList=new LinkedList();
  DirectedAcyclicGraph dag=new DirectedAcyclicGraph();
  CompositeActor container=((CompositeActor)getContainer());
  if (container != null) {
    Enumeration allactors=container.deepGetEntities();
    while (allactors.hasMoreElements()) {
      Actor actor=(Actor)allactors.nextElement();
      Enumeration allports=actor.inputPorts();
      while (allports.hasMoreElements()) {
        IOPort port=(IOPort)allports.nextElement();
        dag.add(port);
        portList.insertLast(port);
      }
    }
  }
  Enumeration copiedPorts=portList.elements();
  while (copiedPorts.hasMoreElements()) {
    IOPort ioPort=(IOPort)copiedPorts.nextElement();
    if (ioPort instanceof DEIOPort) {
      DEIOPort p=(DEIOPort)ioPort;
      Enumeration befores=p.beforePorts();
      while (befores.hasMoreElements()) {
        IOPort after=(IOPort)befores.nextElement();
        if (dag.contains(after)) {
          dag.addEdge(p,after);
        }
 else {
          throw new InternalErrorException("String_Node_Str");
        }
      }
      Enumeration triggers=p.triggersPorts();
      while (triggers.hasMoreElements()) {
        IOPort outPort=(IOPort)triggers.nextElement();
        Enumeration inPortEnum=outPort.deepConnectedInPorts();
        while (inPortEnum.hasMoreElements()) {
          IOPort pp=(IOPort)inPortEnum.nextElement();
          if (dag.contains(pp)) {
            dag.addEdge(p,pp);
          }
 else {
            throw new InternalErrorException("String_Node_Str");
          }
        }
      }
    }
 else {
      Enumeration triggers=((Actor)ioPort.getContainer()).outputPorts();
      while (triggers.hasMoreElements()) {
        IOPort outPort=(IOPort)triggers.nextElement();
        Enumeration inPortEnum=outPort.deepConnectedInPorts();
        while (inPortEnum.hasMoreElements()) {
          IOPort pp=(IOPort)inPortEnum.nextElement();
          if (dag.contains(pp)) {
            dag.addEdge(ioPort,pp);
          }
 else {
            throw new InternalErrorException("String_Node_Str");
          }
        }
      }
    }
    if (!dag.isAcyclic()) {
      throw new IllegalActionException(this,"String_Node_Str" + ioPort.getFullName());
    }
  }
  return dag;
}