Program: 32871
Project: 32871
Buggy source:
/** 
 * Unlinks this node from the sorted tree. This may cause the tree to rotate nodes using AVL rotations.
 */
public void removeFromTree(){
  if (value == null)   throw new IllegalStateException("String_Node_Str");
  if (leftSize == 0 && rightSize == 0) {
    if (parent != null) {
      parent.notifyChildNodeRemoved(this);
      parent.replaceChildNode(this,null);
    }
 else {
      host.setRootNode(null);
    }
    parent=null;
  }
 else   if (leftSize > 0 && rightSize == 0) {
    left.parent=parent;
    if (parent != null) {
      parent.notifyChildNodeRemoved(this);
      parent.replaceChildNode(this,left);
      parent.doRotationsUpTheTree();
    }
 else {
      host.setRootNode(left);
    }
  }
 else   if (leftSize == 0 && rightSize > 0) {
    right.parent=parent;
    if (parent != null) {
      parent.notifyChildNodeRemoved(this);
      parent.replaceChildNode(this,right);
      parent.doRotationsUpTheTree();
    }
 else {
      host.setRootNode(right);
    }
  }
 else {
    IndexedTreeNode middle=null;
    if (leftSize > rightSize) {
      middle=left.getLargestChildNode();
    }
 else {
      middle=right.getSmallestChildNode();
    }
    middle.removeFromTree();
    if (middle.leftSize > 0 || middle.rightSize > 0)     throw new IllegalStateException("String_Node_Str");
    middle.left=left;
    middle.leftSize=leftSize;
    if (left != null)     left.parent=middle;
    middle.right=right;
    middle.rightSize=rightSize;
    if (right != null)     right.parent=middle;
    middle.parent=parent;
    if (parent != null) {
      parent.replaceChildNode(this,middle);
      parent.doRotationsUpTheTree();
    }
 else {
      host.setRootNode(middle);
    }
  }
  parent=null;
  left=null;
  leftSize=0;
  right=null;
  rightSize=0;
}

Fixed version (ground truth):
/** 
 * Unlinks this node from the sorted tree. This may cause the tree to rotate nodes using AVL rotations.
 */
public void removeFromTree(){
  if (value == null)   throw new IllegalStateException("String_Node_Str");
  if (leftSize == 0 && rightSize == 0) {
    if (parent != null) {
      parent.notifyChildNodeRemoved(this);
      parent.replaceChildNode(this,null);
      parent.recalculateHeight();
    }
 else {
      host.setRootNode(null);
    }
    parent=null;
  }
 else   if (leftSize > 0 && rightSize == 0) {
    left.parent=parent;
    if (parent != null) {
      parent.notifyChildNodeRemoved(this);
      parent.replaceChildNode(this,left);
      parent.recalculateHeight();
      parent.doRotationsUpTheTree();
    }
 else {
      host.setRootNode(left);
    }
  }
 else   if (leftSize == 0 && rightSize > 0) {
    right.parent=parent;
    if (parent != null) {
      parent.notifyChildNodeRemoved(this);
      parent.replaceChildNode(this,right);
      parent.recalculateHeight();
      parent.doRotationsUpTheTree();
    }
 else {
      host.setRootNode(right);
    }
  }
 else {
    IndexedTreeNode middle=null;
    if (leftSize > rightSize) {
      middle=left.getLargestChildNode();
    }
 else {
      middle=right.getSmallestChildNode();
    }
    middle.removeFromTree();
    if (middle.leftSize > 0 || middle.rightSize > 0)     throw new IllegalStateException("String_Node_Str");
    middle.left=left;
    middle.leftSize=leftSize;
    if (left != null)     left.parent=middle;
    middle.right=right;
    middle.rightSize=rightSize;
    if (right != null)     right.parent=middle;
    middle.height=height;
    middle.parent=parent;
    if (parent != null) {
      parent.replaceChildNode(this,middle);
      parent.doRotationsUpTheTree();
    }
 else {
      host.setRootNode(middle);
    }
  }
  parent=null;
  left=null;
  leftSize=0;
  right=null;
  rightSize=0;
}