Program: 75815
Project: 75815
Buggy source:
/** 
 * Compute the SCC decomposition of a graph.
 * @return An array of instances of DirectedGraph which representthe SCCs of the graph in topological order.
 */
public DirectedGraph[] sccDecomposition(){
  _computeTransitiveClosure();
  int N=getNodeCount();
  if (_transitiveClosure.length != N)   throw new InternalErrorException("String_Node_Str");
  boolean addedToAnSCC[]=new boolean[N];
  for (int i=0; i < N; i++) {
    addedToAnSCC[i]=false;
  }
  ArrayList sccNodeLists=new ArrayList();
  ArrayList sccRepresentatives=new ArrayList();
  for (int i=0; i < N; i++) {
    if (!addedToAnSCC[i]) {
      ArrayList nodeList=new ArrayList();
      sccNodeLists.add(nodeList);
      Object node=_getNodeObject(i);
      nodeList.add(node);
      sccRepresentatives.add(node);
      addedToAnSCC[i]=true;
      for (int j=i + 1; j < N; j++) {
        if (!addedToAnSCC[j]) {
          if (_transitiveClosure[i][j] && _transitiveClosure[j][i]) {
            nodeList.add(_getNodeObject(j));
            addedToAnSCC[j]=true;
          }
        }
      }
    }
  }
  int numberOfSCCs=sccNodeLists.size();
  Object sortedSCCRepresentatives[];
  try {
    sortedSCCRepresentatives=attemptTopologicalSort(sccRepresentatives.toArray());
  }
 catch (  IllegalActionException ex) {
    throw new InternalErrorException("String_Node_Str" + "String_Node_Str");
  }
  ArrayList sortedSCCNodeLists=new ArrayList();
  for (int i=0; i < numberOfSCCs; i++) {
    Object sccRepresentative=sortedSCCRepresentatives[i];
    for (int j=0; j < numberOfSCCs; j++) {
      ArrayList nodeList=(ArrayList)(sccNodeLists.get(j));
      if (nodeList.get(0) == sccRepresentative)       sortedSCCNodeLists.add(nodeList);
    }
  }
  ArrayList sccs=new ArrayList(numberOfSCCs);
  for (int i=0; i < numberOfSCCs; i++) {
    ArrayList nodeList=(ArrayList)(sortedSCCNodeLists.get(i));
    sccs.add(subgraph(nodeList.toArray()));
  }
  return ((DirectedGraph[])(sccs.toArray()));
}

Fixed version (ground truth):
/** 
 * Compute the SCC decomposition of a graph.
 * @return An array of instances of DirectedGraph which representthe SCCs of the graph in topological order.
 */
public DirectedGraph[] sccDecomposition(){
  _computeTransitiveClosure();
  int N=getNodeCount();
  if (_transitiveClosure.length != N)   throw new InternalErrorException("String_Node_Str");
  boolean addedToAnSCC[]=new boolean[N];
  for (int i=0; i < N; i++) {
    addedToAnSCC[i]=false;
  }
  ArrayList sccNodeLists=new ArrayList();
  ArrayList sccRepresentatives=new ArrayList();
  for (int i=0; i < N; i++) {
    if (!addedToAnSCC[i]) {
      ArrayList nodeList=new ArrayList();
      sccNodeLists.add(nodeList);
      Object node=_getNodeObject(i);
      nodeList.add(node);
      sccRepresentatives.add(node);
      addedToAnSCC[i]=true;
      for (int j=i + 1; j < N; j++) {
        if (!addedToAnSCC[j]) {
          if (_transitiveClosure[i][j] && _transitiveClosure[j][i]) {
            nodeList.add(_getNodeObject(j));
            addedToAnSCC[j]=true;
          }
        }
      }
    }
  }
  int numberOfSCCs=sccNodeLists.size();
  Object sortedSCCRepresentatives[];
  try {
    sortedSCCRepresentatives=attemptTopologicalSort(sccRepresentatives.toArray());
  }
 catch (  IllegalActionException ex) {
    throw new InternalErrorException("String_Node_Str" + "String_Node_Str");
  }
  ArrayList sortedSCCNodeLists=new ArrayList();
  for (int i=0; i < numberOfSCCs; i++) {
    Object sccRepresentative=sortedSCCRepresentatives[i];
    for (int j=0; j < numberOfSCCs; j++) {
      ArrayList nodeList=(ArrayList)(sccNodeLists.get(j));
      if (nodeList.get(0) == sccRepresentative)       sortedSCCNodeLists.add(nodeList);
    }
  }
  DirectedGraph sccs[]=new DirectedGraph[numberOfSCCs];
  for (int i=0; i < numberOfSCCs; i++) {
    ArrayList nodeList=(ArrayList)(sortedSCCNodeLists.get(i));
    sccs[i]=subgraph(nodeList.toArray());
  }
  return sccs;
}