Program: 15904
Project: 15904
Buggy source:
@SuppressWarnings("String_Node_Str") public void render(final Component owner,final Object data,final int index,final int size,final boolean isListModel){
  final Template tm=resolveTemplate(owner,owner,data,index,size,"String_Node_Str");
  if (tm == null) {
    Label l=new Label(data == null ? "String_Node_Str" : data.toString());
    l.setParent(owner);
    return;
  }
  final ForEachStatus iterStatus=new ChildrenBindingForEachStatus(index,data,size);
  final String var=(String)tm.getParameters().get("String_Node_Str");
  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=owner.getAttribute(varnm);
  Object oldIter=owner.getAttribute(itervarnm);
  owner.setAttribute(varnm,data);
  owner.setAttribute(itervarnm,iterStatus);
  Component insertBefore=null;
  List<Component[]> cbrCompsList=(List<Component[]>)owner.getAttribute(BinderCtrl.CHILDREN_BINDING_RENDERED_COMPONENTS);
  if (cbrCompsList != null) {
    int newIndex=0;
    int steps=0;
    for (    Component[] cmps : cbrCompsList) {
      if (steps++ >= index)       break;
      newIndex+=cmps.length;
    }
    if (owner.getChildren().size() > newIndex) {
      insertBefore=owner.getChildren().get(newIndex);
    }
  }
  final Component[] items=ShadowElementsCtrl.filterOutShadows(tm.create(owner,insertBefore,null,null));
  owner.setAttribute(varnm,oldVar);
  owner.setAttribute(itervarnm,oldIter);
  boolean templateTracked=false;
  if (isListModel) {
    cbrCompsList=(List<Component[]>)owner.getAttribute(BinderCtrl.CHILDREN_BINDING_RENDERED_COMPONENTS);
    if (cbrCompsList == null)     cbrCompsList=new LinkedList<Component[]>();
    cbrCompsList.add(items);
    owner.setAttribute(BinderCtrl.CHILDREN_BINDING_RENDERED_COMPONENTS,cbrCompsList);
  }
  for (  final Component comp : items) {
    comp.setAttribute(BinderCtrl.VAR,varnm);
    comp.setAttribute(AbstractRenderer.IS_TEMPLATE_MODEL_ENABLED_ATTR,true);
    comp.setAttribute(AbstractRenderer.CURRENT_INDEX_RESOLVER_ATTR,new IndirectBinding(){
      public Binder getBinder(){
        return BinderUtil.getBinder(comp,true);
      }
      public Component getComponent(){
        return comp;
      }
      public void setValue(      BindELContext ctx,      Object value){
        int index=comp.getParent().getChildren().indexOf(comp) / items.length;
        Collection<?> collection=(Collection<?>)owner.getAttribute(BindELContext.getModelName(owner));
        if (collection instanceof List<?>) {
          List<Object> list=(List<Object>)collection;
          try {
            list.set(index,value);
          }
 catch (          UnsupportedOperationException e) {
            throw new PropertyNotWritableException(e);
          }
catch (          IndexOutOfBoundsException e) {
            throw new PropertyNotFoundException(e);
          }
        }
      }
      public Object getValue(      BindELContext ctx){
        final int index=comp.getParent().getChildren().indexOf(comp) / items.length;
        Collection<Object> collection=(Collection<Object>)owner.getAttribute(BindELContext.getModelName(owner));
        if (collection != null) {
          int i=-1;
          for (          Object o : collection) {
            i++;
            if (i == index)             return o;
          }
        }
        return null;
      }
    }
);
    addItemReference(owner,comp,index,varnm);
    comp.setAttribute(itervarnm,iterStatus);
    if (!templateTracked) {
      comp.setAttribute(TemplateResolver.TEMPLATE_OBJECT,owner.removeAttribute(TemplateResolver.TEMPLATE_OBJECT));
      addTemplateTracking(owner,comp,data,index,size);
      templateTracked=true;
    }
    Events.sendEvent(new Event(BinderCtrl.ON_BIND_INIT,comp));
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public void render(final Component owner,final Object data,final int index,final int size,final boolean isListModel){
  final Template tm=resolveTemplate(owner,owner,data,index,size,"String_Node_Str");
  if (tm == null) {
    Label l=new Label(data == null ? "String_Node_Str" : data.toString());
    l.setParent(owner);
    return;
  }
  final ForEachStatus iterStatus=new ChildrenBindingForEachStatus(index,data,size);
  final String var=(String)tm.getParameters().get("String_Node_Str");
  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=owner.getAttribute(varnm);
  Object oldIter=owner.getAttribute(itervarnm);
  owner.setAttribute(varnm,data);
  owner.setAttribute(itervarnm,iterStatus);
  Component insertBefore=null;
  List<Component[]> cbrCompsList=(List<Component[]>)owner.getAttribute(BinderCtrl.CHILDREN_BINDING_RENDERED_COMPONENTS);
  if (cbrCompsList != null) {
    int newIndex=0;
    int steps=0;
    for (    Component[] cmps : cbrCompsList) {
      if (steps++ >= index)       break;
      newIndex+=cmps.length;
    }
    if (owner.getChildren().size() > newIndex) {
      insertBefore=owner.getChildren().get(newIndex);
    }
  }
  final Component[] items=ShadowElementsCtrl.filterOutShadows(tm.create(owner,insertBefore,null,null));
  owner.setAttribute(varnm,oldVar);
  owner.setAttribute(itervarnm,oldIter);
  boolean templateTracked=false;
  if (isListModel) {
    cbrCompsList=(List<Component[]>)owner.getAttribute(BinderCtrl.CHILDREN_BINDING_RENDERED_COMPONENTS);
    if (cbrCompsList == null)     cbrCompsList=new LinkedList<Component[]>();
    cbrCompsList.add(items);
    owner.setAttribute(BinderCtrl.CHILDREN_BINDING_RENDERED_COMPONENTS,cbrCompsList);
  }
 else {
    recordRenderedIndex(owner,items.length);
  }
  for (  final Component comp : items) {
    comp.setAttribute(BinderCtrl.VAR,varnm);
    comp.setAttribute(AbstractRenderer.IS_TEMPLATE_MODEL_ENABLED_ATTR,true);
    comp.setAttribute(AbstractRenderer.CURRENT_INDEX_RESOLVER_ATTR,new IndirectBinding(){
      public Binder getBinder(){
        return BinderUtil.getBinder(comp,true);
      }
      public Component getComponent(){
        return comp;
      }
      public void setValue(      BindELContext ctx,      Object value){
        int index=BindChildRenderer.this.getRenderedIndex(owner,comp.getParent().getChildren().indexOf(comp));
        Collection<?> collection=(Collection<?>)owner.getAttribute(BindELContext.getModelName(owner));
        if (collection instanceof List<?>) {
          List<Object> list=(List<Object>)collection;
          try {
            list.set(index,value);
          }
 catch (          UnsupportedOperationException e) {
            throw new PropertyNotWritableException(e);
          }
catch (          IndexOutOfBoundsException e) {
            throw new PropertyNotFoundException(e);
          }
        }
      }
      public Object getValue(      BindELContext ctx){
        final int index=BindChildRenderer.this.getRenderedIndex(owner,comp.getParent().getChildren().indexOf(comp));
        Collection<Object> collection=(Collection<Object>)owner.getAttribute(BindELContext.getModelName(owner));
        if (collection != null) {
          if (collection instanceof List<?>) {
            return ((List<Object>)collection).get(index);
          }
 else {
            int i=-1;
            for (            Object o : collection) {
              i++;
              if (i == index)               return o;
            }
          }
        }
        return null;
      }
    }
);
    addItemReference(owner,comp,index,varnm);
    comp.setAttribute(itervarnm,iterStatus);
    if (!templateTracked) {
      comp.setAttribute(TemplateResolver.TEMPLATE_OBJECT,owner.removeAttribute(TemplateResolver.TEMPLATE_OBJECT));
      addTemplateTracking(owner,comp,data,index,size);
      templateTracked=true;
    }
    Events.sendEvent(new Event(BinderCtrl.ON_BIND_INIT,comp));
  }
}