Program: 48258
Project: 48258
Buggy source:
@Override public synchronized void remove() throws AbsTTException {
  checkAccessAndCommit();
  if (getNode().getKind() == EKind.DOCUMENT_ROOT) {
    throw new TTUsageException("String_Node_Str");
  }
 else   if (getNode() instanceof IStructNode) {
    final IStructNode node=(IStructNode)mNodeReadRtx.getNode();
    for (final IAxis axis=new DescendantAxis(this); axis.hasNext(); ) {
      axis.next();
      final IStructNode nodeToDelete=axis.getTransaction().getStructuralNode();
      if (nodeToDelete.getKind() == EKind.ELEMENT) {
        final ElementNode element=(ElementNode)nodeToDelete;
        removeName();
        final int attCount=element.getAttributeCount();
        for (int i=0; i < attCount; i++) {
          moveToAttribute(i);
          removeName();
          getPageTransaction().removeNode(mNodeReadRtx.getNode(),EPage.NODEPAGE);
          moveToParent();
        }
        final int nspCount=element.getNamespaceCount();
        for (int i=0; i < nspCount; i++) {
          moveToNamespace(i);
          removeName();
          getPageTransaction().removeNode(mNodeReadRtx.getNode(),EPage.NODEPAGE);
          moveToParent();
        }
      }
      getPageTransaction().removeNode(nodeToDelete,EPage.NODEPAGE);
    }
    mNodeReadRtx.setCurrentNode(node);
    adaptHashesWithRemove();
    adaptForRemove(node,EPage.NODEPAGE);
    mNodeReadRtx.setCurrentNode(node);
    if (node.getKind() == EKind.ELEMENT) {
      removeName();
    }
    if (node.hasRightSibling() && moveTo(node.getRightSiblingKey())) {
    }
 else     if (node.hasLeftSibling()) {
      moveTo(node.getLeftSiblingKey());
    }
 else {
      moveTo(node.getParentKey());
    }
  }
 else   if (getNode().getKind() == EKind.ATTRIBUTE) {
    final INode node=mNodeReadRtx.getNode();
    final ElementNode parent=(ElementNode)getPageTransaction().prepareNodeForModification(node.getParentKey(),EPage.NODEPAGE);
    parent.removeAttribute(node.getNodeKey());
    getPageTransaction().finishNodeModification(parent,EPage.NODEPAGE);
    adaptHashesWithRemove();
    getPageTransaction().removeNode(node,EPage.NODEPAGE);
    removeName();
    moveToParent();
  }
 else   if (getNode().getKind() == EKind.NAMESPACE) {
    final INode node=mNodeReadRtx.getNode();
    final ElementNode parent=(ElementNode)getPageTransaction().prepareNodeForModification(node.getParentKey(),EPage.NODEPAGE);
    parent.removeNamespace(node.getNodeKey());
    getPageTransaction().finishNodeModification(parent,EPage.NODEPAGE);
    adaptHashesWithRemove();
    getPageTransaction().removeNode(node,EPage.NODEPAGE);
    removeName();
    moveToParent();
  }
}

Fixed version (ground truth):
@Override public synchronized void remove() throws AbsTTException {
  checkAccessAndCommit();
  if (getNode().getKind() == EKind.DOCUMENT_ROOT) {
    throw new TTUsageException("String_Node_Str");
  }
 else   if (getNode() instanceof IStructNode) {
    final IStructNode node=(IStructNode)mNodeReadRtx.getNode();
    for (final IAxis axis=new DescendantAxis(this); axis.hasNext(); ) {
      axis.next();
      final IStructNode nodeToDelete=axis.getTransaction().getStructuralNode();
      if (nodeToDelete.getKind() == EKind.ELEMENT) {
        final ElementNode element=(ElementNode)nodeToDelete;
        removeNonStructural(element);
        removeName();
      }
      getPageTransaction().removeNode(nodeToDelete,EPage.NODEPAGE);
    }
    mNodeReadRtx.setCurrentNode(node);
    adaptHashesWithRemove();
    adaptForRemove(node,EPage.NODEPAGE);
    mNodeReadRtx.setCurrentNode(node);
    if (node.getKind() == EKind.ELEMENT) {
      removeName();
    }
    if (node.hasRightSibling() && moveTo(node.getRightSiblingKey())) {
    }
 else     if (node.hasLeftSibling()) {
      moveTo(node.getLeftSiblingKey());
    }
 else {
      moveTo(node.getParentKey());
    }
  }
 else   if (getNode().getKind() == EKind.ATTRIBUTE) {
    final INode node=mNodeReadRtx.getNode();
    final ElementNode parent=(ElementNode)getPageTransaction().prepareNodeForModification(node.getParentKey(),EPage.NODEPAGE);
    parent.removeAttribute(node.getNodeKey());
    getPageTransaction().finishNodeModification(parent,EPage.NODEPAGE);
    adaptHashesWithRemove();
    getPageTransaction().removeNode(node,EPage.NODEPAGE);
    removeName();
    moveToParent();
  }
 else   if (getNode().getKind() == EKind.NAMESPACE) {
    final INode node=mNodeReadRtx.getNode();
    final ElementNode parent=(ElementNode)getPageTransaction().prepareNodeForModification(node.getParentKey(),EPage.NODEPAGE);
    parent.removeNamespace(node.getNodeKey());
    getPageTransaction().finishNodeModification(parent,EPage.NODEPAGE);
    adaptHashesWithRemove();
    getPageTransaction().removeNode(node,EPage.NODEPAGE);
    removeName();
    moveToParent();
  }
}