Program: 15922
Project: 15922
Buggy source:
public void render(final Listitem item,final Object data,final int index) throws Exception {
  final Listbox listbox=(Listbox)item.getParent();
  final int size=listbox.getModel().getSize();
  final String subtype=item instanceof Listgroup ? "String_Node_Str" : item instanceof Listgroupfoot ? "String_Node_Str" : null;
  final Template tm=resolveTemplate(listbox,item,data,index,size,"String_Node_Str",subtype);
  if (tm == null) {
    item.setLabel(Objects.toString(data));
    item.setValue(data);
  }
 else {
    final ForEachStatus iterStatus=new AbstractForEachStatus(){
      private static final long serialVersionUID=1L;
      public int getIndex(){
        return index;
      }
      public Object getCurrent(){
        return data;
      }
      public Integer getEnd(){
        return size;
      }
    }
;
    final String var=(String)tm.getParameters().get(EACH_ATTR);
    final String varnm=var == null ? EACH_VAR : var;
    final String itervar=(String)tm.getParameters().get(STATUS_ATTR);
    final String itervarnm=itervar == null ? (var == null ? EACH_STATUS_VAR : varnm + STATUS_POST_VAR) : itervar;
    Object oldVar=listbox.getAttribute(varnm);
    Object oldIter=listbox.getAttribute(itervarnm);
    listbox.setAttribute(varnm,data);
    listbox.setAttribute(itervarnm,iterStatus);
    final Component[] items=filterOutShadows(listbox,tm.create(listbox,item,null,null));
    listbox.setAttribute(varnm,oldVar);
    listbox.setAttribute(itervarnm,oldIter);
    if (items.length != 1)     throw new UiException("String_Node_Str" + items.length);
    final Listitem nli=(Listitem)items[0];
    nli.setAttribute(BinderCtrl.VAR,varnm);
    recordRenderedIndex(listbox,items.length);
    nli.setAttribute(AbstractRenderer.IS_TEMPLATE_MODEL_ENABLED_ATTR,true);
    nli.setAttribute(AbstractRenderer.CURRENT_INDEX_RESOLVER_ATTR,new IndirectBinding(){
      public Binder getBinder(){
        return BinderUtil.getBinder(nli,true);
      }
      @SuppressWarnings("String_Node_Str") public void setValue(      BindELContext ctx,      Object value){
        int idx=BindListitemRenderer.this.getRenderedIndex(listbox,nli.getIndex());
        ListModel<?> listmodel=listbox.getListModel();
        if (idx >= 0 && idx < listmodel.getSize()) {
          if (listmodel instanceof ListModelArray) {
            ((ListModelArray<Object>)listmodel).set(idx,value);
          }
 else           if (listmodel instanceof ListModelList<?>) {
            ((ListModelList<Object>)listmodel).set(idx,value);
          }
        }
 else {
        }
      }
      public Component getComponent(){
        return nli;
      }
      public Object getValue(      BindELContext ctx){
        return listbox.getModel().getElementAt(BindListitemRenderer.this.getRenderedIndex(listbox,nli.getIndex()));
      }
    }
);
    addItemReference(listbox,nli,index,varnm);
    nli.setAttribute(itervarnm,iterStatus);
    if (nli instanceof Listgroup && item instanceof Listgroup) {
      ((Listgroup)nli).setOpen(((Listgroup)item).isOpen());
    }
    nli.setAttribute(TemplateResolver.TEMPLATE_OBJECT,item.removeAttribute(TemplateResolver.TEMPLATE_OBJECT));
    addTemplateTracking(listbox,nli,data,index,size);
    if (nli.getValue() == null)     nli.setValue(data);
    item.setAttribute(Attributes.MODEL_RENDERAS,nli);
    item.detach();
  }
}

Fixed version (ground truth):
public void render(final Listitem item,final Object data,final int index) throws Exception {
  final Listbox listbox=(Listbox)item.getParent();
  final int size=listbox.getModel().getSize();
  final String subtype=item instanceof Listgroup ? "String_Node_Str" : item instanceof Listgroupfoot ? "String_Node_Str" : null;
  final Template tm=resolveTemplate(listbox,item,data,index,size,"String_Node_Str",subtype);
  if (tm == null) {
    item.setLabel(Objects.toString(data));
    item.setValue(data);
  }
 else {
    final ForEachStatus iterStatus=new AbstractForEachStatus(){
      private static final long serialVersionUID=1L;
      public int getIndex(){
        return index;
      }
      public Object getCurrent(){
        return data;
      }
      public Integer getEnd(){
        return size;
      }
    }
;
    final String var=(String)tm.getParameters().get(EACH_ATTR);
    final String varnm=var == null ? EACH_VAR : var;
    final String itervar=(String)tm.getParameters().get(STATUS_ATTR);
    final String itervarnm=itervar == null ? (var == null ? EACH_STATUS_VAR : varnm + STATUS_POST_VAR) : itervar;
    Object oldVar=listbox.getAttribute(varnm);
    Object oldIter=listbox.getAttribute(itervarnm);
    listbox.setAttribute(varnm,data);
    listbox.setAttribute(itervarnm,iterStatus);
    final Component[] items=filterOutShadows(listbox,tm.create(listbox,item,null,null));
    if (oldVar != null) {
      listbox.setAttribute(varnm,oldVar);
    }
 else {
      listbox.removeAttribute(varnm);
    }
    if (oldIter != null) {
      listbox.setAttribute(itervarnm,oldIter);
    }
 else {
      listbox.removeAttribute(itervarnm);
    }
    if (items.length != 1)     throw new UiException("String_Node_Str" + items.length);
    final Listitem nli=(Listitem)items[0];
    nli.setAttribute(BinderCtrl.VAR,varnm);
    recordRenderedIndex(listbox,items.length);
    nli.setAttribute(AbstractRenderer.IS_TEMPLATE_MODEL_ENABLED_ATTR,true);
    nli.setAttribute(AbstractRenderer.CURRENT_INDEX_RESOLVER_ATTR,new IndirectBinding(){
      public Binder getBinder(){
        return BinderUtil.getBinder(nli,true);
      }
      @SuppressWarnings("String_Node_Str") public void setValue(      BindELContext ctx,      Object value){
        int idx=BindListitemRenderer.this.getRenderedIndex(listbox,nli.getIndex());
        ListModel<?> listmodel=listbox.getListModel();
        if (idx >= 0 && idx < listmodel.getSize()) {
          if (listmodel instanceof ListModelArray) {
            ((ListModelArray<Object>)listmodel).set(idx,value);
          }
 else           if (listmodel instanceof ListModelList<?>) {
            ((ListModelList<Object>)listmodel).set(idx,value);
          }
        }
 else {
        }
      }
      public Component getComponent(){
        return nli;
      }
      public Object getValue(      BindELContext ctx){
        return listbox.getModel().getElementAt(BindListitemRenderer.this.getRenderedIndex(listbox,nli.getIndex()));
      }
    }
);
    addItemReference(listbox,nli,index,varnm);
    nli.setAttribute(itervarnm,iterStatus);
    if (nli instanceof Listgroup && item instanceof Listgroup) {
      ((Listgroup)nli).setOpen(((Listgroup)item).isOpen());
    }
    Object obj=item.removeAttribute(TemplateResolver.TEMPLATE_OBJECT);
    if (obj != null) {
      nli.setAttribute(TemplateResolver.TEMPLATE_OBJECT,obj);
    }
 else {
      nli.removeAttribute(TemplateResolver.TEMPLATE_OBJECT);
    }
    addTemplateTracking(listbox,nli,data,index,size);
    if (nli.getValue() == null)     nli.setValue(data);
    item.setAttribute(Attributes.MODEL_RENDERAS,nli);
    item.detach();
  }
}