Program: 15984
Project: 15984
Buggy source:
public void beforeHostChildRemoved(Component child,int indexOfChild){
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str" + child + "String_Node_Str"+ ShadowElementsCtrl.getCurrentInfo());
  }
  Object currentInfo=ShadowElementsCtrl.getCurrentInfo();
  if (currentInfo instanceof HtmlShadowElement) {
    if (currentInfo == this) {
      adjustInsertionForRemove(this,child);
      boolean isEdge=false;
      Component oldFirst=_firstInsertion;
      Component oldLast=_lastInsertion;
      if (child == _firstInsertion) {
        if (_firstInsertion == _lastInsertion) {
          _firstInsertion=_lastInsertion=null;
        }
 else {
          _firstInsertion=child.getNextSibling();
          oldLast=oldFirst;
        }
        isEdge=true;
      }
 else       if (child == _lastInsertion) {
        isEdge=true;
        _lastInsertion=child.getPreviousSibling();
        oldFirst=oldLast;
      }
      if (isEdge && getParent() != null) {
        asShadow(getParent()).shrinkRange(oldFirst,oldLast);
      }
      return;
    }
 else     if (isAncestor(this,asShadow(currentInfo))) {
      asShadow(currentInfo).beforeHostChildRemoved(child,indexOfChild);
      return;
    }
  }
 else {
    if (_firstInsertion == null)     return;
    List<Component> children=child.getParent().getChildren();
    int selfFirstIndex=children.indexOf(_firstInsertion);
    if (indexOfChild < selfFirstIndex)     return;
    Map<Component,Integer> indexMap=fillUpIndexMap(_firstInsertion,_lastInsertion);
    int[] selfIndex=getInsertionIndex(_firstInsertion,_lastInsertion,fillUpIndexMap(_firstInsertion,_lastInsertion));
    if (selfIndex[1] < indexOfChild)     return;
    HtmlShadowElement node=queryIntersectedShadowIfAny(indexOfChild,indexMap);
    if (node != null) {
      try {
        ShadowElementsCtrl.setCurrentInfo(node);
        asShadow(node).beforeHostChildRemoved(child,indexOfChild);
      }
  finally {
        ShadowElementsCtrl.setCurrentInfo(currentInfo);
      }
    }
  }
}

Fixed version (ground truth):
public void beforeHostChildRemoved(Component child,int indexOfChild){
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str" + child + "String_Node_Str"+ ShadowElementsCtrl.getCurrentInfo());
  }
  Object currentInfo=ShadowElementsCtrl.getCurrentInfo();
  if (currentInfo instanceof HtmlShadowElement) {
    if (currentInfo == this) {
      adjustInsertionForRemove(this,child);
      boolean isEdge=false;
      Component oldFirst=_firstInsertion;
      Component oldLast=_lastInsertion;
      if (child == _firstInsertion) {
        if (_firstInsertion == _lastInsertion) {
          _firstInsertion=_lastInsertion=null;
        }
 else {
          _firstInsertion=child.getNextSibling();
          oldLast=oldFirst;
        }
        isEdge=true;
      }
 else       if (child == _lastInsertion) {
        isEdge=true;
        _lastInsertion=child.getPreviousSibling();
        oldFirst=oldLast;
      }
      if (isEdge && getParent() != null) {
        asShadow(getParent()).shrinkRange(oldFirst,oldLast);
      }
      return;
    }
 else     if (isAncestor(this,asShadow(currentInfo))) {
      asShadow(currentInfo).beforeHostChildRemoved(child,indexOfChild);
      return;
    }
  }
 else {
    if (_firstInsertion == null)     return;
    List<Component> children=child.getParent().getChildren();
    int selfFirstIndex=children.indexOf(_firstInsertion);
    if (indexOfChild < selfFirstIndex)     return;
    Map<Component,Integer> indexMap=fillUpIndexMap(_firstInsertion,_lastInsertion);
    int[] selfIndex=getInsertionIndex(_firstInsertion,_lastInsertion,fillUpIndexMap(_firstInsertion,_lastInsertion));
    if (selfIndex[1] < indexOfChild) {
      if (_previousInsertion == child) {
        setPrevInsertion(this,child.getPreviousSibling());
      }
 else       if (_nextInsertion == child) {
        setPrevInsertion(child.getNextSibling(),this);
      }
      return;
    }
    HtmlShadowElement node=queryIntersectedShadowIfAny(indexOfChild,indexMap);
    if (node != null) {
      try {
        ShadowElementsCtrl.setCurrentInfo(node);
        asShadow(node).beforeHostChildRemoved(child,indexOfChild);
      }
  finally {
        ShadowElementsCtrl.setCurrentInfo(currentInfo);
      }
    }
  }
}