Program: 51838
Project: 51838
Buggy source:
private void setupTable(){
  List<XulComponent> colCollection=getColumns().getChildNodes();
  String cols[]=new String[colCollection.size()];
  SelectionPolicy selectionPolicy=null;
  if ("String_Node_Str".equals(getSeltype())) {
    selectionPolicy=SelectionPolicy.ONE_ROW;
  }
 else   if ("String_Node_Str".equals(getSeltype())) {
    selectionPolicy=SelectionPolicy.MULTI_ROW;
  }
  int[] widths=new int[cols.length];
  int totalFlex=0;
  for (int i=0; i < cols.length; i++) {
    totalFlex+=colCollection.get(i).getFlex();
  }
  boolean allFlexing=true;
  int totalWidth=0;
  for (int i=0; i < cols.length; i++) {
    cols[i]=((XulTreeCol)colCollection.get(i)).getLabel();
    if (totalFlex > 0 && getWidth() > 0) {
      widths[i]=(int)(getWidth() * ((double)colCollection.get(i).getFlex() / totalFlex));
      totalWidth+=widths[i];
    }
 else     if (getColumns().getColumn(i).getWidth() > 0) {
      allFlexing=false;
      widths[i]=getColumns().getColumn(i).getWidth();
      totalWidth+=widths[i];
    }
  }
  table=new BaseTable(cols,widths,new BaseColumnComparator[cols.length],selectionPolicy);
  if (getHeight() != 0) {
    table.setHeight(getHeight() + "String_Node_Str");
  }
 else {
    table.setHeight("String_Node_Str");
  }
  if (getWidth() != 0) {
    table.setWidth(getWidth() + "String_Node_Str");
  }
 else {
    table.setWidth("String_Node_Str");
  }
  if (allFlexing) {
    table.fillWidth();
  }
  table.addTableSelectionListener(new TableSelectionListener(){
    public void onAllRowsDeselected(    SourceTableSelectionEvents sender){
    }
    public void onCellHover(    SourceTableSelectionEvents sender,    int row,    int cell){
    }
    public void onCellUnhover(    SourceTableSelectionEvents sender,    int row,    int cell){
    }
    public void onRowDeselected(    SourceTableSelectionEvents sender,    int row){
    }
    public void onRowHover(    SourceTableSelectionEvents sender,    int row){
    }
    public void onRowUnhover(    SourceTableSelectionEvents sender,    int row){
    }
    public void onRowsSelected(    SourceTableSelectionEvents sender,    int firstRow,    int numRows){
      try {
        if (getOnselect() != null && getOnselect().trim().length() > 0) {
          getXulDomContainer().invoke(getOnselect(),new Object[]{});
        }
        Integer[] selectedRows=table.getSelectedRows().toArray(new Integer[table.getSelectedRows().size()]);
        int[] rows=new int[selectedRows.length];
        for (int i=0; i < selectedRows.length; i++) {
          rows[i]=selectedRows[i];
        }
        GwtTree.this.setSelectedRows(rows);
        GwtTree.this.colCollection=getColumns().getChildNodes();
        if (GwtTree.this.isShowalleditcontrols() == false) {
          if (curSelectedRow > -1) {
            Object[] curSelectedRowOriginal=new Object[getColumns().getColumnCount()];
            for (int j=0; j < getColumns().getColumnCount(); j++) {
              curSelectedRowOriginal[j]=getColumnEditor(j,curSelectedRow);
            }
            table.replaceRow(curSelectedRow,curSelectedRowOriginal);
          }
          curSelectedRow=rows[0];
          Object[] newRow=new Object[getColumns().getColumnCount()];
          for (int j=0; j < getColumns().getColumnCount(); j++) {
            newRow[j]=getColumnEditor(j,rows[0]);
          }
          table.replaceRow(rows[0],newRow);
        }
      }
 catch (      XulException e) {
        e.printStackTrace();
      }
    }
  }
);
  setWidgetInPanel(table);
  updateUI();
}

Fixed version (ground truth):
private void setupTable(){
  List<XulComponent> colCollection=getColumns().getChildNodes();
  String cols[]=new String[colCollection.size()];
  SelectionPolicy selectionPolicy=null;
  if ("String_Node_Str".equals(getSeltype())) {
    selectionPolicy=SelectionPolicy.ONE_ROW;
  }
 else   if ("String_Node_Str".equals(getSeltype())) {
    selectionPolicy=SelectionPolicy.MULTI_ROW;
  }
  int[] widths=new int[cols.length];
  int totalFlex=0;
  for (int i=0; i < cols.length; i++) {
    totalFlex+=colCollection.get(i).getFlex();
  }
  boolean allFlexing=true;
  int totalWidth=0;
  for (int i=0; i < cols.length; i++) {
    cols[i]=((XulTreeCol)colCollection.get(i)).getLabel();
    if (totalFlex > 0 && getWidth() > 0) {
      widths[i]=(int)(getWidth() * ((double)colCollection.get(i).getFlex() / totalFlex));
      totalWidth+=widths[i];
    }
 else     if (getColumns().getColumn(i).getWidth() > 0) {
      allFlexing=false;
      widths[i]=getColumns().getColumn(i).getWidth();
      totalWidth+=widths[i];
    }
  }
  table=new BaseTable(cols,widths,new BaseColumnComparator[cols.length],selectionPolicy,this);
  if (getHeight() != 0) {
    table.setHeight(getHeight() + "String_Node_Str");
  }
 else {
    table.setHeight("String_Node_Str");
  }
  if (getWidth() != 0) {
    table.setWidth(getWidth() + "String_Node_Str");
  }
 else {
    table.setWidth("String_Node_Str");
  }
  if (allFlexing) {
    table.fillWidth();
  }
  table.addTableSelectionListener(new TableSelectionListener(){
    public void onAllRowsDeselected(    SourceTableSelectionEvents sender){
    }
    public void onCellHover(    SourceTableSelectionEvents sender,    int row,    int cell){
    }
    public void onCellUnhover(    SourceTableSelectionEvents sender,    int row,    int cell){
    }
    public void onRowDeselected(    SourceTableSelectionEvents sender,    int row){
    }
    public void onRowHover(    SourceTableSelectionEvents sender,    int row){
    }
    public void onRowUnhover(    SourceTableSelectionEvents sender,    int row){
    }
    public void onRowsSelected(    SourceTableSelectionEvents sender,    int firstRow,    int numRows){
      try {
        if (getOnselect() != null && getOnselect().trim().length() > 0) {
          getXulDomContainer().invoke(getOnselect(),new Object[]{});
        }
        Integer[] selectedRows=table.getSelectedRows().toArray(new Integer[table.getSelectedRows().size()]);
        int[] rows=new int[selectedRows.length];
        for (int i=0; i < selectedRows.length; i++) {
          rows[i]=selectedRows[i];
        }
        GwtTree.this.setSelectedRows(rows);
        GwtTree.this.colCollection=getColumns().getChildNodes();
        if (GwtTree.this.isShowalleditcontrols() == false) {
          if (curSelectedRow > -1) {
            Object[] curSelectedRowOriginal=new Object[getColumns().getColumnCount()];
            for (int j=0; j < getColumns().getColumnCount(); j++) {
              curSelectedRowOriginal[j]=getColumnEditor(j,curSelectedRow);
            }
            table.replaceRow(curSelectedRow,curSelectedRowOriginal);
          }
          curSelectedRow=rows[0];
          Object[] newRow=new Object[getColumns().getColumnCount()];
          for (int j=0; j < getColumns().getColumnCount(); j++) {
            newRow[j]=getColumnEditor(j,rows[0]);
          }
          table.replaceRow(rows[0],newRow);
        }
      }
 catch (      XulException e) {
        e.printStackTrace();
      }
    }
  }
);
  setWidgetInPanel(table);
  updateUI();
}