Program: 16027
Project: 16027
Buggy source:
/** 
 * Merge the all sub-tree into the parent's insertions, unlike  {@link #appendChild(Component)}
 */
protected void mergeSubTree(){
  List<HtmlShadowElement> children=getChildren();
  if (children == null || children.isEmpty())   return;
  if (_parent != null) {
    for (    HtmlShadowElement child : new ArrayList<HtmlShadowElement>(children)) {
      Component previous=child._previousInsertion;
      Component next=child._nextInsertion;
      _parent.insertBefore(child,this);
      if (previous != null && !(previous instanceof HtmlShadowElement)) {
        Component newPrevious=child._previousInsertion;
        setPrevInsertion(previous,newPrevious);
        setPrevInsertion(child,previous);
      }
      if (next != null && !(next instanceof HtmlShadowElement)) {
        Component newNext=child._nextInsertion;
        setPrevInsertion(newNext,next);
        setPrevInsertion(next,child);
      }
    }
  }
 else {
    for (    HtmlShadowElement child : new ArrayList<HtmlShadowElement>(children)) {
      Component previous=_previousInsertion;
      child.mergeToHost(_host);
      if (previous != null) {
        Component newPrevious=child._previousInsertion;
        if (newPrevious == null) {
          setPrevInsertion(child,previous);
        }
 else {
          setPrevInsertion(newPrevious,previous);
        }
      }
      Component newNext=child._nextInsertion;
      if (newNext == null) {
        setPrevInsertion(this,child);
      }
 else {
        setPrevInsertion(this,newNext);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Merge the all sub-tree into the parent's insertions, unlike  {@link #appendChild(Component)}
 */
protected void mergeSubTree(){
  List<HtmlShadowElement> children=getChildren();
  if (children == null || children.isEmpty())   return;
  if (_parent != null) {
    for (    HtmlShadowElement child : new ArrayList<HtmlShadowElement>(children)) {
      Component previous=child._previousInsertion;
      Component next=child._nextInsertion;
      _parent.insertBefore(child,this);
      if (previous != null && !(previous instanceof HtmlShadowElement)) {
        Component newPrevious=child._previousInsertion;
        setPrevInsertion(previous,newPrevious);
        setPrevInsertion(child,previous);
      }
      if (next != null && !(next instanceof HtmlShadowElement)) {
        Component newNext=child._nextInsertion;
        setPrevInsertion(newNext,next);
        setPrevInsertion(next,child);
      }
      if (_firstInsertion == child._firstInsertion)       _firstInsertion=null;
      if (_lastInsertion == child._lastInsertion)       _lastInsertion=null;
    }
  }
 else {
    for (    HtmlShadowElement child : new ArrayList<HtmlShadowElement>(children)) {
      Component previous=_previousInsertion;
      child.mergeToHost(_host);
      if (previous != null) {
        Component newPrevious=child._previousInsertion;
        if (newPrevious == null) {
          setPrevInsertion(child,previous);
        }
 else {
          setPrevInsertion(newPrevious,previous);
        }
      }
      Component newNext=child._nextInsertion;
      if (newNext == null) {
        setPrevInsertion(this,child);
      }
 else {
        setPrevInsertion(this,newNext);
      }
      if (_firstInsertion == child._firstInsertion)       _firstInsertion=null;
      if (_lastInsertion == child._lastInsertion)       _lastInsertion=null;
    }
  }
}