Program: 101617
Project: 101617
Buggy source:
/** 
 * Reduce the number of edits by eliminating semantically trivial equalities.
 * @param diffs List of Difference objects
 */
public static void cleanupSemantic(final List diffs){
  boolean changes=false;
  Stack equalities=new Stack();
  String lastEquality="String_Node_Str";
  int lengthChangesPre=0;
  int lengthChangesPost=0;
  ListIterator pointer=diffs.listIterator();
  Difference curDiff=pointer.hasNext() ? (Difference)pointer.next() : null;
  while (curDiff != null) {
    EditType editType=curDiff.getEditType();
    if (EditType.EQUAL.equals(editType)) {
      equalities.push(curDiff);
      lengthChangesPre=lengthChangesPost;
      lengthChangesPost=0;
      lastEquality=curDiff.getText();
    }
 else {
      lengthChangesPost+=curDiff.getText().length();
      int lastLen=lastEquality != null ? lastEquality.length() : 0;
      if (lastEquality != null && (lastLen <= lengthChangesPre) && (lastLen <= lengthChangesPost)) {
        while (curDiff != equalities.lastElement()) {
          curDiff=(Difference)pointer.previous();
        }
        pointer.next();
        pointer.set(new Difference(EditType.DELETE,lastEquality));
        pointer.add(new Difference(EditType.INSERT,lastEquality));
        equalities.pop();
        if (!equalities.empty()) {
          equalities.pop();
        }
        if (equalities.empty()) {
          while (pointer.hasPrevious()) {
            pointer.previous();
          }
        }
 else {
          curDiff=(Difference)equalities.lastElement();
          while (curDiff != pointer.previous()) {
          }
        }
        lengthChangesPre=0;
        lengthChangesPost=0;
        lastEquality=null;
        changes=true;
      }
    }
    curDiff=pointer.hasNext() ? (Difference)pointer.next() : null;
  }
  if (changes) {
    cleanupMerge(diffs);
  }
}

Fixed version (ground truth):
/** 
 * Reduce the number of edits by eliminating semantically trivial equalities.
 * @param diffs List of Difference objects
 */
public static void cleanupSemantic(final List diffs){
  boolean changes=false;
  Stack equalities=new Stack();
  String lastEquality=null;
  int lengthChangesPre=0;
  int lengthChangesPost=0;
  ListIterator pointer=diffs.listIterator();
  Difference curDiff=pointer.hasNext() ? (Difference)pointer.next() : null;
  while (curDiff != null) {
    EditType editType=curDiff.getEditType();
    if (EditType.EQUAL.equals(editType)) {
      equalities.push(curDiff);
      lengthChangesPre=lengthChangesPost;
      lengthChangesPost=0;
      lastEquality=curDiff.getText();
    }
 else {
      lengthChangesPost+=curDiff.getText().length();
      int lastLen=lastEquality != null ? lastEquality.length() : 0;
      if (lastEquality != null && (lastLen <= lengthChangesPre) && (lastLen <= lengthChangesPost)) {
        while (curDiff != equalities.lastElement()) {
          curDiff=(Difference)pointer.previous();
        }
        pointer.next();
        pointer.set(new Difference(EditType.DELETE,lastEquality));
        pointer.add(new Difference(EditType.INSERT,lastEquality));
        equalities.pop();
        if (!equalities.empty()) {
          equalities.pop();
        }
        if (equalities.empty()) {
          while (pointer.hasPrevious()) {
            pointer.previous();
          }
        }
 else {
          curDiff=(Difference)equalities.lastElement();
          while (curDiff != pointer.previous()) {
          }
        }
        lengthChangesPre=0;
        lengthChangesPost=0;
        lastEquality=null;
        changes=true;
      }
    }
    curDiff=pointer.hasNext() ? (Difference)pointer.next() : null;
  }
  if (changes) {
    cleanupMerge(diffs);
  }
}