Program: 16520
Project: 16520
Buggy source:
/** 
 * Processes an AU request. <p> Default: in addition to what are handled by   {@link XulElement#service}, it also handles onSelect.
 * @since 5.0.0
 */
public void service(org.zkoss.zk.au.AuRequest request,boolean everError){
  final String cmd=request.getCommand();
  if (cmd.equals("String_Node_Str")) {
    Events.postEvent(DataLoadingEvent.getDataLoadingEvent(request,getPreloadSize()));
  }
 else   if (cmd.equals("String_Node_Str")) {
    final Map data=request.getData();
    _currentTop=AuRequests.getInt(data,"String_Node_Str",0);
    _currentLeft=AuRequests.getInt(data,"String_Node_Str",0);
  }
 else   if (cmd.equals("String_Node_Str")) {
    _topPad=AuRequests.getInt(request.getData(),"String_Node_Str",0);
  }
 else   if (cmd.equals(Events.ON_SELECT)) {
    SelectEvent evt=SelectEvent.getSelectEvent(request);
    Set selItems=evt.getSelectedItems();
    _noSmartUpdate=true;
    try {
      if (AuRequests.getBoolean(request.getData(),"String_Node_Str"))       clearSelection();
      final boolean paging=inPagingMold();
      if (!_multiple || (!paging && (selItems == null || selItems.size() <= 1))) {
        final Listitem item=selItems != null && selItems.size() > 0 ? (Listitem)selItems.iterator().next() : null;
        selectItem(item);
      }
 else {
        int from, to;
        if (paging) {
          final Paginal pgi=getPaginal();
          int pgsz=pgi.getPageSize();
          from=pgi.getActivePage() * pgsz;
          to=from + pgsz;
        }
 else {
          from=to=0;
        }
        int j=0;
        for (Iterator it=_items.iterator(); it.hasNext(); ++j) {
          final Listitem item=(Listitem)it.next();
          if (selItems.contains(item)) {
            addItemToSelection(item);
          }
 else           if (!paging) {
            removeItemFromSelection(item);
          }
 else {
            final int index=item.getIndex();
            if (index >= from && index < to)             removeItemFromSelection(item);
          }
        }
      }
    }
  finally {
      _noSmartUpdate=false;
    }
    Events.postEvent(evt);
  }
 else   if (cmd.equals("String_Node_Str")) {
    final String width=AuRequests.getInnerWidth(request);
    _innerWidth=width == null ? "String_Node_Str" : width;
  }
 else   if (cmd.equals(Events.ON_RENDER)) {
    final Set items=AuRequests.convertToItems(request.getDesktop(),(List)request.getData().get("String_Node_Str"));
    int cnt=items.size();
    if (cnt == 0)     return;
    cnt=20 - cnt;
    if (cnt > 0 && _preloadsz > 0) {
      if (cnt > _preloadsz)       cnt=_preloadsz;
      final List toload=new LinkedList();
      Iterator it=_items.iterator();
      while (it.hasNext()) {
        final Listitem li=(Listitem)it.next();
        if (items.contains(li))         break;
        if (!li.isLoaded())         toload.add(0,li);
      }
      if (!toload.isEmpty()) {
        int bfcnt=cnt / 3;
        for (Iterator e=toload.iterator(); bfcnt > 0 && e.hasNext(); --bfcnt, --cnt) {
          items.add(e.next());
        }
      }
      while (cnt > 0 && it.hasNext()) {
        final Listitem li=(Listitem)it.next();
        if (!li.isLoaded() && items.add(li))         --cnt;
      }
    }
    Listbox.this.renderItems(items);
  }
 else   super.service(request,everError);
}

Fixed version (ground truth):
/** 
 * Processes an AU request. <p> Default: in addition to what are handled by   {@link XulElement#service}, it also handles onSelect.
 * @since 5.0.0
 */
public void service(org.zkoss.zk.au.AuRequest request,boolean everError){
  final String cmd=request.getCommand();
  if (cmd.equals("String_Node_Str")) {
    if (_rod)     Executions.getCurrent().setAttribute("String_Node_Str" + this.getUuid(),Boolean.TRUE);
    Events.postEvent(DataLoadingEvent.getDataLoadingEvent(request,getPreloadSize()));
  }
 else   if (cmd.equals("String_Node_Str")) {
    final Map data=request.getData();
    _currentTop=AuRequests.getInt(data,"String_Node_Str",0);
    _currentLeft=AuRequests.getInt(data,"String_Node_Str",0);
  }
 else   if (cmd.equals("String_Node_Str")) {
    _topPad=AuRequests.getInt(request.getData(),"String_Node_Str",0);
  }
 else   if (cmd.equals(Events.ON_SELECT)) {
    if (_rod && Executions.getCurrent().getAttribute("String_Node_Str" + this.getUuid()) != null)     return;
    SelectEvent evt=SelectEvent.getSelectEvent(request);
    Set selItems=evt.getSelectedItems();
    _noSmartUpdate=true;
    try {
      if (AuRequests.getBoolean(request.getData(),"String_Node_Str"))       clearSelection();
      final boolean paging=inPagingMold();
      if (!_multiple || (!paging && (selItems == null || selItems.size() <= 1))) {
        final Listitem item=selItems != null && selItems.size() > 0 ? (Listitem)selItems.iterator().next() : null;
        selectItem(item);
      }
 else {
        int from, to;
        if (paging) {
          final Paginal pgi=getPaginal();
          int pgsz=pgi.getPageSize();
          from=pgi.getActivePage() * pgsz;
          to=from + pgsz;
        }
 else {
          from=to=0;
        }
        int j=0;
        for (Iterator it=_items.iterator(); it.hasNext(); ++j) {
          final Listitem item=(Listitem)it.next();
          if (selItems.contains(item)) {
            addItemToSelection(item);
          }
 else           if (!paging) {
            removeItemFromSelection(item);
          }
 else {
            final int index=item.getIndex();
            if (index >= from && index < to)             removeItemFromSelection(item);
          }
        }
      }
    }
  finally {
      _noSmartUpdate=false;
    }
    Events.postEvent(evt);
  }
 else   if (cmd.equals("String_Node_Str")) {
    final String width=AuRequests.getInnerWidth(request);
    _innerWidth=width == null ? "String_Node_Str" : width;
  }
 else   if (cmd.equals(Events.ON_RENDER)) {
    final Set items=AuRequests.convertToItems(request.getDesktop(),(List)request.getData().get("String_Node_Str"));
    int cnt=items.size();
    if (cnt == 0)     return;
    cnt=20 - cnt;
    if (cnt > 0 && _preloadsz > 0) {
      if (cnt > _preloadsz)       cnt=_preloadsz;
      final List toload=new LinkedList();
      Iterator it=_items.iterator();
      while (it.hasNext()) {
        final Listitem li=(Listitem)it.next();
        if (items.contains(li))         break;
        if (!li.isLoaded())         toload.add(0,li);
      }
      if (!toload.isEmpty()) {
        int bfcnt=cnt / 3;
        for (Iterator e=toload.iterator(); bfcnt > 0 && e.hasNext(); --bfcnt, --cnt) {
          items.add(e.next());
        }
      }
      while (cnt > 0 && it.hasNext()) {
        final Listitem li=(Listitem)it.next();
        if (!li.isLoaded() && items.add(li))         --cnt;
      }
    }
    Listbox.this.renderItems(items);
  }
 else   super.service(request,everError);
}