Program: 72668
Project: 72668
Buggy source:
public void fire() throws IllegalActionException {
  super.fire();
  if (chordName.hasToken(0)) {
    String chord=((StringToken)chordName.get(0)).stringValue();
    _notes.add(chord);
  }
  if (chordDuration.hasToken(0)) {
    double duration=((DoubleToken)chordDuration.get(0)).doubleValue();
    _durations.add(duration);
  }
  if (chordIndex.hasToken(0)) {
    int ts=((IntToken)chordIndex.get(0)).intValue();
    _timestamps.add(ts);
  }
  if (endChord.hasToken(0)) {
    _terminateChord=true;
    _chordLength=((IntToken)endChord.get(0)).intValue();
    _orderedChords.put(_chordLength + 1,new Chord(MusicSpecs.TERMINATION_CHORD,0.0));
    _terminateLength=_chordLength;
  }
  if (_notes.size() == _durations.size() && _notes.size() == _timestamps.size() && _notes.size() >= _terminateLength && _terminateLength > 0) {
    for (int i=_timestamps.size() - 1; i >= 0; i--) {
      int index=_timestamps.get(i);
      if (index < _durations.size() && index < _notes.size()) {
        double duration=_durations.get(index);
        _orderedChords.put(index,new Chord(_notes.get(index),duration));
        _timestamps.remove(i);
      }
    }
  }
  if (_terminateChord && _orderedChords.keySet().size() >= _terminateLength) {
    List keysSoFar=new LinkedList();
    keysSoFar.addAll(_orderedChords.keySet());
    Collections.sort(keysSoFar);
    Iterator iter=keysSoFar.iterator();
    while (iter.hasNext()) {
      chords.send(0,new ObjectToken((Chord)_orderedChords.get(iter.next())));
    }
    _orderedChords.clear();
    _notes.clear();
    _durations.clear();
    _timestamps.clear();
    _terminateChord=false;
    _terminateLength=0;
  }
}

Fixed version (ground truth):
public void fire() throws IllegalActionException {
  super.fire();
  if (chordName.hasToken(0)) {
    String chord=((StringToken)chordName.get(0)).stringValue();
    _chordNames.add(chord);
  }
  if (chordDuration.hasToken(0)) {
    double duration=((DoubleToken)chordDuration.get(0)).doubleValue();
    _durations.add(duration);
  }
  if (chordIndex.hasToken(0)) {
    int ts=((IntToken)chordIndex.get(0)).intValue();
    _timestamps.add(ts);
  }
  if (endChord.hasToken(0)) {
    _terminateChord=true;
    _chordLength=((IntToken)endChord.get(0)).intValue();
    _orderedChords.put(_chordLength + 1,new Chord(MusicSpecs.TERMINATION_CHORD,0.0));
  }
  if (_chordNames.size() == _durations.size() && _chordNames.size() == _timestamps.size() && _chordNames.size() >= _chordLength && _chordLength > 0) {
    for (int i=_timestamps.size() - 1; i >= 0; i--) {
      int index=_timestamps.get(i);
      if (index < _durations.size() && index < _chordNames.size()) {
        double duration=_durations.get(index);
        _orderedChords.put(index,new Chord(_chordNames.get(index),duration));
        _timestamps.remove(i);
      }
    }
  }
  if (_terminateChord && _orderedChords.keySet().size() >= _chordLength) {
    List keysSoFar=new LinkedList();
    keysSoFar.addAll(_orderedChords.keySet());
    Collections.sort(keysSoFar);
    Iterator iter=keysSoFar.iterator();
    while (iter.hasNext()) {
      chords.send(0,new ObjectToken(_orderedChords.get(iter.next())));
    }
    _orderedChords.clear();
    _chordNames.clear();
    _durations.clear();
    _timestamps.clear();
    _terminateChord=false;
    _chordLength=0;
  }
}