Program: 76318
Project: 76318
Buggy source:
/** 
 * @exception IllegalActionException If there is no director.
 */
public void fire() throws IllegalActionException {
  _debug("String_Node_Str");
  HashMap map=new HashMap();
  Vector codeVector=new Vector();
  int counter=0;
  for (int i=0; i < size; i++) {
    Token object=(Token)(input.get(0));
    String key=object.stringValue();
    if (map.containsKey(key)) {
      int temp=((Integer)map.get(key)).intValue();
      temp=temp + 1;
      map.put(key,new Integer(temp));
    }
 else {
      map.put(key,new Integer(1));
      codeVector.add(key);
      counter=counter + 1;
    }
  }
  _debug("String_Node_Str" + counter);
  HuffTree[] huffArray=new HuffTree[counter];
  int currentSize=counter;
  for (int j=0; j < counter; j++) {
    Object leafObject=codeVector.elementAt(j);
    String key=codeVector.elementAt(j).toString();
    int count=((Integer)map.get(key)).intValue();
    huffArray[j]=new HuffLeaf(key,(double)count / size);
    _debug("String_Node_Str" + j);
    _debug(huffArray[j].toString());
  }
  while (currentSize > 1) {
    _debug("String_Node_Str" + currentSize);
    for (int c=0; c < currentSize; c++) {
      _debug(huffArray[c].toString());
    }
    double minimum1=1.0;
    int first=0;
    double minimum2=1.0;
    int second=0;
    for (int i=0; i < currentSize; i++) {
      double currentProb=huffArray[i].getProb();
      if (currentProb < minimum1) {
        minimum1=currentProb;
        first=i;
        _debug("String_Node_Str" + first);
      }
    }
    for (int j=0; j < currentSize; j++) {
      double currentProb=huffArray[j].getProb();
      if ((currentProb < minimum2) && (j != first)) {
        minimum2=currentProb;
        _debug("String_Node_Str" + second);
        second=j;
      }
    }
    _debug("String_Node_Str" + first);
    _debug("String_Node_Str" + second);
    HuffTree tree=new HuffTree();
    tree.addLeft(huffArray[first]);
    tree.addRight(huffArray[second]);
    huffArray[first]=tree;
    huffArray[second]=huffArray[currentSize - 1];
    currentSize--;
  }
  System.out.println(huffArray[0].printPreOrder());
  ObjectToken token=new ObjectToken(huffArray[0]);
  output.broadcast(token);
}

Fixed version (ground truth):
/** 
 * @exception IllegalActionException If there is no director.
 */
public void fire() throws IllegalActionException {
  _debug("String_Node_Str");
  HashMap map=new HashMap();
  Vector codeVector=new Vector();
  int counter=0;
  for (int i=0; i < size; i++) {
    Token object=(Token)(input.get(0));
    String key=object.stringValue();
    if (map.containsKey(key)) {
      int temp=((Integer)map.get(key)).intValue();
      temp=temp + 1;
      map.put(key,new Integer(temp));
    }
 else {
      map.put(key,new Integer(1));
      codeVector.add(key);
      counter=counter + 1;
    }
  }
  _debug("String_Node_Str" + counter);
  HuffTree[] huffArray=new HuffTree[counter];
  int currentSize=counter;
  for (int j=0; j < counter; j++) {
    Object leafObject=codeVector.elementAt(j);
    String key=codeVector.elementAt(j).toString();
    int count=((Integer)map.get(key)).intValue();
    huffArray[j]=new HuffLeaf(key,(double)count / size);
    _debug("String_Node_Str" + j);
    _debug(huffArray[j].toString());
  }
  while (currentSize > 1) {
    _debug("String_Node_Str" + currentSize);
    for (int c=0; c < currentSize; c++) {
      _debug(huffArray[c].toString());
    }
    double minimum1=1.0;
    int first=0;
    double minimum2=1.0;
    int second=0;
    for (int i=0; i < currentSize; i++) {
      double currentProb=huffArray[i].getProb();
      if (currentProb < minimum1) {
        minimum1=currentProb;
        first=i;
        _debug("String_Node_Str" + first);
      }
    }
    for (int j=0; j < currentSize; j++) {
      double currentProb=huffArray[j].getProb();
      if ((currentProb < minimum2) && (j != first)) {
        minimum2=currentProb;
        _debug("String_Node_Str" + second);
        second=j;
      }
    }
    _debug("String_Node_Str" + first);
    _debug("String_Node_Str" + second);
    HuffTree tree=new HuffTree();
    tree.addLeft(huffArray[first]);
    tree.addRight(huffArray[second]);
    huffArray[first]=tree;
    huffArray[second]=huffArray[currentSize - 1];
    currentSize--;
  }
  System.out.println(huffArray[0].printPreOrder());
  ObjectToken token=new ObjectToken(huffArray[0]);
  output.send(0,token);
}