Program: 16090
Project: 16090
Buggy source:
public void onEvent(PagingEvent event){
  if (inPagingMold()) {
    if (WebApps.getFeature("String_Node_Str") && getModel() != null) {
      if (_rodPagingIndex == null)       _rodPagingIndex=new LinkedList<Integer>();
      int ap=event.getActivePage();
      int size=Tree.this.getPaginal().getPageSize();
      int mps=maxRodPageSize();
      if (mps >= 0 && !_rodPagingIndex.contains(ap)) {
        _rodPagingIndex.add(ap);
      }
      if (mps >= 1 && mps < _rodPagingIndex.size()) {
        LinkedList<Integer> sortedIndex=new LinkedList<Integer>();
        mps=_rodPagingIndex.size() - mps;
        while (mps-- > 0) {
          sortedIndex.add(_rodPagingIndex.removeFirst());
        }
        Collections.sort(sortedIndex);
        int i=0;
        int start=sortedIndex.removeFirst() * size;
        int end=start + size;
        for (        Treeitem ti : new ArrayList<Treeitem>(Tree.this.getItems())) {
          if (i < start) {
            i++;
            continue;
          }
          if (i >= end) {
            if (sortedIndex.isEmpty()) {
              break;
            }
 else {
              start=sortedIndex.removeFirst() * size;
              end=start + size;
            }
          }
          if (ti.isRendered()) {
            ti.getChildren().clear();
            ti.setRendered(false);
          }
          i++;
        }
      }
      int start=ap * size;
      int end=start + size;
      int i=0;
      final Renderer renderer=new Renderer();
      try {
        for (        Treeitem ti : new ArrayList<Treeitem>(Tree.this.getItems())) {
          if (i < start) {
            i++;
            continue;
          }
          if (i >= end) {
            break;
          }
          if (!ti.isRendered()) {
            ti.getChildren().clear();
            Treechildren parent=(Treechildren)ti.getParent();
            Object childNode=Tree.this.getAssociatedNode(ti,Tree.this);
            renderChildren0(renderer,parent,ti,childNode,i);
          }
          i++;
        }
      }
 catch (      Throwable ex) {
        renderer.doCatch(ex);
      }
 finally {
        renderer.doFinally();
      }
    }
    invalidate();
  }
}

Fixed version (ground truth):
public void onEvent(PagingEvent event){
  if (inPagingMold()) {
    if (WebApps.getFeature("String_Node_Str") && getModel() != null) {
      if (_rodPagingIndex == null)       _rodPagingIndex=new LinkedList<Integer>();
      int ap=event.getActivePage();
      int size=Tree.this.getPaginal().getPageSize();
      int mps=maxRodPageSize();
      if (mps >= 0 && !_rodPagingIndex.contains(ap)) {
        _rodPagingIndex.add(ap);
      }
      if (mps >= 1 && mps < _rodPagingIndex.size()) {
        LinkedList<Integer> sortedIndex=new LinkedList<Integer>();
        mps=_rodPagingIndex.size() - mps;
        while (mps-- > 0) {
          sortedIndex.add(_rodPagingIndex.removeFirst());
        }
        Collections.sort(sortedIndex);
        int i=0;
        int start=sortedIndex.removeFirst() * size;
        int end=start + size;
        for (        Treeitem ti : new ArrayList<Treeitem>(Tree.this.getItems())) {
          if (i < start) {
            i++;
            continue;
          }
          if (i >= end) {
            if (sortedIndex.isEmpty()) {
              break;
            }
 else {
              start=sortedIndex.removeFirst() * size;
              end=start + size;
            }
          }
          if (!ti.isOpen()) {
            ti.getChildren().clear();
            ti.setRendered(false);
          }
          i++;
        }
      }
      int start=ap * size;
      int end=start + size;
      int i=0;
      final Renderer renderer=new Renderer();
      try {
        for (        Treeitem ti : new ArrayList<Treeitem>(Tree.this.getItems())) {
          if (i < start) {
            i++;
            continue;
          }
          if (i >= end) {
            break;
          }
          if (!ti.isRendered()) {
            ti.getChildren().clear();
            Treechildren parent=(Treechildren)ti.getParent();
            Object childNode=Tree.this.getAssociatedNode(ti,Tree.this);
            renderChildren0(renderer,parent,ti,childNode,i);
          }
          i++;
        }
      }
 catch (      Throwable ex) {
        renderer.doCatch(ex);
      }
 finally {
        renderer.doFinally();
      }
    }
    invalidate();
  }
}