Program: 16585
Project: 16585
Buggy source:
/** 
 * Update the number of the visible item before it is removed or after it is added.
 */
private void updateVisibleCount(Listitem item,boolean isRemove){
  if (item instanceof Listgroup || item.isVisible()) {
    final Listgroup g=getListgroupAt(item.getIndex());
    if (item instanceof Listgroupfoot || item instanceof Listgroup || g == null || g.isOpen())     addVisibleItemCount(isRemove ? -1 : 1);
    if (item instanceof Listgroup) {
      final Listgroup group=(Listgroup)item;
      if (item.getPreviousSibling() instanceof Listitem) {
        final Listitem preRow=(Listitem)item.getPreviousSibling();
        if (preRow == null) {
          if (!group.isOpen()) {
            addVisibleItemCount(isRemove ? group.getVisibleItemCount() : -group.getVisibleItemCount());
          }
        }
 else {
          final Listgroup preGroup=getListgroupAt(preRow.getIndex());
          if (preGroup != null) {
            if (!preGroup.isOpen() && group.isOpen())             addVisibleItemCount(isRemove ? -group.getVisibleItemCount() : group.getVisibleItemCount());
 else             if (preGroup.isOpen() && !group.isOpen())             addVisibleItemCount(isRemove ? group.getVisibleItemCount() : -group.getVisibleItemCount());
          }
 else {
            if (!group.isOpen())             addVisibleItemCount(isRemove ? group.getVisibleItemCount() : -group.getVisibleItemCount());
          }
        }
      }
 else       if (!group.isOpen()) {
        addVisibleItemCount(isRemove ? group.getVisibleItemCount() : -group.getVisibleItemCount());
      }
    }
  }
  if (inPagingMold())   getPaginal().setTotalSize(getVisibleItemCount());
}

Fixed version (ground truth):
/** 
 * Update the number of the visible item before it is removed or after it is added.
 */
private void updateVisibleCount(Listitem item,boolean isRemove){
  if (item instanceof Listgroup || item.isVisible()) {
    final Listgroup g=getListgroupAt(item.getIndex());
    if (item instanceof Listgroupfoot || item instanceof Listgroup || g == null || g.isOpen())     addVisibleItemCount(isRemove ? -1 : 1);
    if (item instanceof Listgroup) {
      final Listgroup group=(Listgroup)item;
      if (item.getPreviousSibling() instanceof Listitem) {
        final Listitem preRow=(Listitem)item.getPreviousSibling();
        if (preRow == null) {
          if (!group.isOpen()) {
            addVisibleItemCount(isRemove ? group.getVisibleItemCount() : -group.getVisibleItemCount());
          }
        }
 else {
          final Listgroup preGroup=preRow instanceof Listgroup ? (Listgroup)preRow : getListgroupAt(preRow.getIndex());
          if (preGroup != null) {
            if (!preGroup.isOpen() && group.isOpen())             addVisibleItemCount(isRemove ? -group.getVisibleItemCount() : group.getVisibleItemCount());
 else             if (preGroup.isOpen() && !group.isOpen())             addVisibleItemCount(isRemove ? group.getVisibleItemCount() : -group.getVisibleItemCount());
          }
 else {
            if (!group.isOpen())             addVisibleItemCount(isRemove ? group.getVisibleItemCount() : -group.getVisibleItemCount());
          }
        }
      }
 else       if (!group.isOpen()) {
        addVisibleItemCount(isRemove ? group.getVisibleItemCount() : -group.getVisibleItemCount());
      }
    }
  }
  if (inPagingMold())   getPaginal().setTotalSize(getVisibleItemCount());
}