Program: 51911
Project: 51911
Buggy source:
public <T>void setElements(Collection<T> elements){
  suppressEvents=true;
  this.elements=elements;
  this.getRootChildren().removeAll();
  if (table != null) {
    CellEditor ce=table.getCellEditor();
    if (ce != null) {
      ce.stopCellEditing();
    }
  }
  if (elements == null) {
    if (table != null) {
      table.updateUI();
    }
 else {
      tree.updateUI();
    }
    changeSupport.firePropertyChange("String_Node_Str",null,getSelectedRows());
    return;
  }
  try {
    if (table != null) {
      for (      T o : elements) {
        XulTreeRow row=this.getRootChildren().addNewRow();
        for (int x=0; x < this.getColumns().getChildNodes().size(); x++) {
          XulComponent col=this.getColumns().getColumn(x);
          final XulTreeCell cell=(XulTreeCell)getDocument().createElement("String_Node_Str");
          XulTreeCol column=(XulTreeCol)col;
          for (          InlineBindingExpression exp : ((XulTreeCol)col).getBindingExpressions()) {
            logger.debug("String_Node_Str" + exp + "String_Node_Str"+ cell+ "String_Node_Str"+ o+ "String_Node_Str");
            String colType=column.getType();
            if (StringUtils.isEmpty(colType) == false && colType.equalsIgnoreCase("String_Node_Str")) {
              colType=extractDynamicColType(o,x);
            }
            if (colType == null) {
              if (StringUtils.isNotEmpty(exp.getModelAttr())) {
                DefaultBinding binding=new DefaultBinding(o,exp.getModelAttr(),cell,exp.getXulCompAttr());
                if (!this.editable) {
                  binding.setBindingType(Binding.Type.ONE_WAY);
                }
                domContainer.addBinding(binding);
                binding.fireSourceChanged();
              }
            }
 else             if (colType.equalsIgnoreCase("String_Node_Str") || colType.equalsIgnoreCase("String_Node_Str") && column.getCombobinding() != null) {
              DefaultBinding binding=new DefaultBinding(o,column.getCombobinding(),cell,"String_Node_Str");
              binding.setBindingType(Binding.Type.ONE_WAY);
              domContainer.addBinding(binding);
              binding.fireSourceChanged();
              binding=new DefaultBinding(o,((XulTreeCol)col).getBinding(),cell,"String_Node_Str");
              binding.setConversion(new BindingConvertor<Object,Integer>(){
                @Override public Integer sourceToTarget(                Object value){
                  int index=((Vector)cell.getValue()).indexOf(value);
                  return index > -1 ? index : 0;
                }
                @Override public Object targetToSource(                Integer value){
                  return ((Vector)cell.getValue()).get(value);
                }
              }
);
              domContainer.addBinding(binding);
              binding.fireSourceChanged();
              if (colType.equalsIgnoreCase("String_Node_Str")) {
                binding=new DefaultBinding(o,exp.getModelAttr(),cell,exp.getXulCompAttr());
                if (!this.editable) {
                  binding.setBindingType(Binding.Type.ONE_WAY);
                }
 else {
                  binding.setBindingType(Binding.Type.BI_DIRECTIONAL);
                }
                domContainer.addBinding(binding);
              }
            }
 else             if (colType.equalsIgnoreCase("String_Node_Str")) {
              if (StringUtils.isNotEmpty(exp.getModelAttr())) {
                DefaultBinding binding=new DefaultBinding(o,exp.getModelAttr(),cell,"String_Node_Str");
                if (!this.editable) {
                  binding.setBindingType(Binding.Type.ONE_WAY);
                }
                domContainer.addBinding(binding);
                binding.fireSourceChanged();
              }
            }
 else             if (colType != null && this.customEditors.containsKey(colType)) {
              DefaultBinding binding=new DefaultBinding(o,exp.getModelAttr(),cell,"String_Node_Str");
              binding.setBindingType(Binding.Type.BI_DIRECTIONAL);
              domContainer.addBinding(binding);
              binding.fireSourceChanged();
            }
 else {
              if (StringUtils.isNotEmpty(exp.getModelAttr())) {
                DefaultBinding binding=new DefaultBinding(o,exp.getModelAttr(),cell,exp.getXulCompAttr());
                if (!this.editable) {
                  binding.setBindingType(Binding.Type.ONE_WAY);
                }
                domContainer.addBinding(binding);
                binding.fireSourceChanged();
              }
            }
          }
          if (column.getDisabledbinding() != null) {
            String prop=column.getDisabledbinding();
            DefaultBinding bind=new DefaultBinding(o,column.getDisabledbinding(),cell,"String_Node_Str");
            bind.setBindingType(Binding.Type.ONE_WAY);
            domContainer.addBinding(bind);
            bind.fireSourceChanged();
          }
          row.addCell(cell);
        }
      }
    }
 else {
      for (      T o : elements) {
        XulTreeRow row=this.getRootChildren().addNewRow();
        addTreeChild(o,row);
      }
    }
    if (table != null) {
      table.updateUI();
    }
 else {
      setupTree();
      tree.updateUI();
    }
    suppressEvents=false;
    changeSupport.firePropertyChange("String_Node_Str",null,getSelectedRows());
  }
 catch (  XulException e) {
    logger.error("String_Node_Str",e);
  }
catch (  Exception e) {
    logger.error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public <T>void setElements(Collection<T> elements){
  suppressEvents=true;
  this.elements=elements;
  this.getRootChildren().removeAll();
  if (table != null) {
    CellEditor ce=table.getCellEditor();
    if (ce != null) {
      ce.stopCellEditing();
    }
  }
  if (elements == null) {
    if (table != null) {
      table.updateUI();
    }
 else {
      tree.updateUI();
    }
    changeSupport.firePropertyChange("String_Node_Str",null,getSelectedRows());
    return;
  }
  try {
    if (table != null) {
      for (      T o : elements) {
        XulTreeRow row=this.getRootChildren().addNewRow();
        for (int x=0; x < this.getColumns().getChildNodes().size(); x++) {
          XulComponent col=this.getColumns().getColumn(x);
          final XulTreeCell cell=(XulTreeCell)getDocument().createElement("String_Node_Str");
          XulTreeCol column=(XulTreeCol)col;
          for (          InlineBindingExpression exp : ((XulTreeCol)col).getBindingExpressions()) {
            logger.debug("String_Node_Str" + exp + "String_Node_Str"+ cell+ "String_Node_Str"+ o+ "String_Node_Str");
            String colType=column.getType();
            if (StringUtils.isEmpty(colType) == false && colType.equalsIgnoreCase("String_Node_Str")) {
              colType=extractDynamicColType(o,x);
            }
            if (colType == null) {
              if (StringUtils.isNotEmpty(exp.getModelAttr())) {
                DefaultBinding binding=new DefaultBinding(o,exp.getModelAttr(),cell,exp.getXulCompAttr());
                if (!this.editable) {
                  binding.setBindingType(Binding.Type.ONE_WAY);
                }
                domContainer.addBinding(binding);
                binding.fireSourceChanged();
              }
            }
 else             if ((colType.equalsIgnoreCase("String_Node_Str") || colType.equalsIgnoreCase("String_Node_Str")) && column.getCombobinding() != null) {
              DefaultBinding binding=new DefaultBinding(o,column.getCombobinding(),cell,"String_Node_Str");
              binding.setBindingType(Binding.Type.ONE_WAY);
              domContainer.addBinding(binding);
              binding.fireSourceChanged();
              binding=new DefaultBinding(o,((XulTreeCol)col).getBinding(),cell,"String_Node_Str");
              binding.setConversion(new BindingConvertor<Object,Integer>(){
                @Override public Integer sourceToTarget(                Object value){
                  int index=((Vector)cell.getValue()).indexOf(value);
                  return index > -1 ? index : 0;
                }
                @Override public Object targetToSource(                Integer value){
                  return ((Vector)cell.getValue()).get(value);
                }
              }
);
              domContainer.addBinding(binding);
              binding.fireSourceChanged();
              if (colType.equalsIgnoreCase("String_Node_Str")) {
                binding=new DefaultBinding(o,exp.getModelAttr(),cell,exp.getXulCompAttr());
                if (!this.editable) {
                  binding.setBindingType(Binding.Type.ONE_WAY);
                }
 else {
                  binding.setBindingType(Binding.Type.BI_DIRECTIONAL);
                }
                domContainer.addBinding(binding);
              }
            }
 else             if (colType.equalsIgnoreCase("String_Node_Str")) {
              if (StringUtils.isNotEmpty(exp.getModelAttr())) {
                DefaultBinding binding=new DefaultBinding(o,exp.getModelAttr(),cell,"String_Node_Str");
                if (!this.editable) {
                  binding.setBindingType(Binding.Type.ONE_WAY);
                }
                domContainer.addBinding(binding);
                binding.fireSourceChanged();
              }
            }
 else             if (colType != null && this.customEditors.containsKey(colType)) {
              DefaultBinding binding=new DefaultBinding(o,exp.getModelAttr(),cell,"String_Node_Str");
              binding.setBindingType(Binding.Type.BI_DIRECTIONAL);
              domContainer.addBinding(binding);
              binding.fireSourceChanged();
            }
 else {
              if (StringUtils.isNotEmpty(exp.getModelAttr())) {
                DefaultBinding binding=new DefaultBinding(o,exp.getModelAttr(),cell,exp.getXulCompAttr());
                if (!this.editable) {
                  binding.setBindingType(Binding.Type.ONE_WAY);
                }
                domContainer.addBinding(binding);
                binding.fireSourceChanged();
              }
            }
          }
          if (column.getDisabledbinding() != null) {
            String prop=column.getDisabledbinding();
            DefaultBinding bind=new DefaultBinding(o,column.getDisabledbinding(),cell,"String_Node_Str");
            bind.setBindingType(Binding.Type.ONE_WAY);
            domContainer.addBinding(bind);
            bind.fireSourceChanged();
          }
          row.addCell(cell);
        }
      }
    }
 else {
      for (      T o : elements) {
        XulTreeRow row=this.getRootChildren().addNewRow();
        addTreeChild(o,row);
      }
    }
    if (table != null) {
      table.updateUI();
    }
 else {
      setupTree();
      tree.updateUI();
    }
    suppressEvents=false;
    changeSupport.firePropertyChange("String_Node_Str",null,getSelectedRows());
  }
 catch (  XulException e) {
    logger.error("String_Node_Str",e);
  }
catch (  Exception e) {
    logger.error("String_Node_Str",e);
  }
}