Program: 145065
Project: 145065
Buggy source:
public void finalizeTriggerables(){
  Vector partialOrdering=new Vector();
  for (int i=0; i < triggerables.size(); i++) {
    Triggerable t=(Triggerable)triggerables.elementAt(i);
    Vector deps=new Vector();
    if (t.canCascade()) {
      for (int j=0; j < t.getTargets().size(); j++) {
        TreeReference target=(TreeReference)t.getTargets().elementAt(j);
        Vector triggered=(Vector)triggerIndex.get(target);
        if (triggered != null) {
          for (int k=0; k < triggered.size(); k++) {
            Triggerable u=(Triggerable)triggered.elementAt(k);
            if (!deps.contains(u))             deps.addElement(u);
          }
        }
      }
    }
    for (int j=0; j < deps.size(); j++) {
      Triggerable u=(Triggerable)deps.elementAt(j);
      Triggerable[] edge={t,u};
      partialOrdering.addElement(edge);
    }
  }
  Vector vertices=new Vector();
  for (int i=0; i < triggerables.size(); i++)   vertices.addElement(triggerables.elementAt(i));
  triggerables.removeAllElements();
  while (vertices.size() > 0) {
    Vector roots=new Vector();
    for (int i=0; i < vertices.size(); i++) {
      roots.addElement(vertices.elementAt(i));
    }
    for (int i=0; i < partialOrdering.size(); i++) {
      Triggerable[] edge=(Triggerable[])partialOrdering.elementAt(i);
      roots.removeElement(edge[1]);
    }
    if (roots.size() == 0) {
      throw new RuntimeException("String_Node_Str");
    }
    for (int i=0; i < roots.size(); i++) {
      Triggerable root=(Triggerable)roots.elementAt(i);
      triggerables.addElement(root);
      vertices.removeElement(root);
    }
    for (int i=partialOrdering.size() - 1; i >= 0; i--) {
      Triggerable[] edge=(Triggerable[])partialOrdering.elementAt(i);
      if (roots.contains(edge[0]))       partialOrdering.removeElementAt(i);
    }
  }
  triggerablesInOrder=true;
}

Fixed version (ground truth):
public void finalizeTriggerables(){
  Vector partialOrdering=new Vector();
  for (int i=0; i < triggerables.size(); i++) {
    Triggerable t=(Triggerable)triggerables.elementAt(i);
    Vector deps=new Vector();
    if (t.canCascade()) {
      for (int j=0; j < t.getTargets().size(); j++) {
        TreeReference target=(TreeReference)t.getTargets().elementAt(j);
        Vector triggered=(Vector)triggerIndex.get(target);
        if (triggered != null) {
          for (int k=0; k < triggered.size(); k++) {
            Triggerable u=(Triggerable)triggered.elementAt(k);
            if (!deps.contains(u))             deps.addElement(u);
          }
        }
      }
    }
    for (int j=0; j < deps.size(); j++) {
      Triggerable u=(Triggerable)deps.elementAt(j);
      Triggerable[] edge={t,u};
      partialOrdering.addElement(edge);
    }
  }
  Vector vertices=new Vector();
  for (int i=0; i < triggerables.size(); i++)   vertices.addElement(triggerables.elementAt(i));
  triggerables.removeAllElements();
  while (vertices.size() > 0) {
    Vector roots=new Vector();
    for (int i=0; i < vertices.size(); i++) {
      roots.addElement(vertices.elementAt(i));
    }
    for (int i=0; i < partialOrdering.size(); i++) {
      Triggerable[] edge=(Triggerable[])partialOrdering.elementAt(i);
      roots.removeElement(edge[1]);
    }
    if (roots.size() == 0) {
      throw new RuntimeException("String_Node_Str");
    }
    for (int i=0; i < roots.size(); i++) {
      Triggerable root=(Triggerable)roots.elementAt(i);
      triggerables.addElement(root);
      vertices.removeElement(root);
    }
    for (int i=partialOrdering.size() - 1; i >= 0; i--) {
      Triggerable[] edge=(Triggerable[])partialOrdering.elementAt(i);
      if (roots.contains(edge[0]))       partialOrdering.removeElementAt(i);
    }
  }
  triggerablesInOrder=true;
  conditionRepeatTargetIndex=new Hashtable();
  for (int i=0; i < triggerables.size(); i++) {
    Triggerable t=(Triggerable)triggerables.elementAt(i);
    if (t instanceof Condition) {
      Vector targets=t.getTargets();
      for (int j=0; j < targets.size(); j++) {
        TreeReference target=(TreeReference)targets.elementAt(j);
        if (instance.getTemplate(target) != null) {
          conditionRepeatTargetIndex.put(target,(Condition)t);
        }
      }
    }
  }
}