Program: 47586
Project: 47586
Buggy source:
public void onFetchRepositoryFileTree(RepositoryFileTree fileTree,List<RepositoryFile> repositoryTrashItems){
  if (fileTree == null) {
    WaitPopup.getInstance().setVisible(false);
    return;
  }
  repositoryFileTree=fileTree;
  trashItems=repositoryTrashItems;
  clear();
  RepositoryFile rootRepositoryFile=repositoryFileTree.getFile();
  FileTreeItem rootItem=null;
  if (createRootNode) {
    rootItem=new FileTreeItem();
    rootItem.setText(rootRepositoryFile.getPath());
    rootItem.setTitle(rootRepositoryFile.getPath());
    rootItem.getElement().setId(rootRepositoryFile.getId());
    rootItem.setFileName("String_Node_Str");
    addItem(rootItem);
    buildSolutionTree(rootItem,repositoryFileTree);
  }
 else {
    buildSolutionTree(null,repositoryFileTree);
    ArrayList<TreeItem> roots=new ArrayList<TreeItem>();
    for (int i=0; i < getItemCount(); i++) {
      roots.add(getItem(i));
    }
    Collections.sort(roots,new Comparator<TreeItem>(){
      public int compare(      TreeItem o1,      TreeItem o2){
        return o1.getText().compareTo(o2.getText());
      }
    }
);
    clear();
    for (    TreeItem myRootItem : roots) {
      addItem(myRootItem);
    }
  }
  fixLeafs();
  buildTrash();
  if (selectedItem != null) {
    ArrayList<TreeItem> parents=new ArrayList<TreeItem>();
    while (selectedItem != null) {
      parents.add(selectedItem);
      selectedItem=selectedItem.getParentItem();
    }
    Collections.reverse(parents);
    selectFromList(parents);
  }
 else {
    for (int i=0; i < getItemCount(); i++) {
      getItem(i).setState(true);
    }
  }
  WaitPopup.getInstance().setVisible(false);
}

Fixed version (ground truth):
public void onFetchRepositoryFileTree(RepositoryFileTree fileTree,List<RepositoryFile> repositoryTrashItems){
  if (fileTree == null) {
    WaitPopup.getInstance().setVisible(false);
    return;
  }
  repositoryFileTree=fileTree;
  trashItems=repositoryTrashItems;
  clear();
  RepositoryFile rootRepositoryFile=repositoryFileTree.getFile();
  FileTreeItem rootItem=null;
  if (createRootNode) {
    rootItem=new FileTreeItem();
    rootItem.setText(rootRepositoryFile.getPath());
    rootItem.setTitle(rootRepositoryFile.getPath());
    rootItem.getElement().setId(rootRepositoryFile.getId());
    rootItem.setFileName("String_Node_Str");
    addItem(rootItem);
    buildSolutionTree(rootItem,repositoryFileTree);
  }
 else {
    buildSolutionTree(null,repositoryFileTree);
    ArrayList<TreeItem> roots=new ArrayList<TreeItem>();
    for (int i=0; i < getItemCount(); i++) {
      roots.add(getItem(i));
    }
    Collections.sort(roots,new Comparator<TreeItem>(){
      public int compare(      TreeItem o1,      TreeItem o2){
        return o1.getText().compareTo(o2.getText());
      }
    }
);
    clear();
    for (    TreeItem myRootItem : roots) {
      addItem(myRootItem);
    }
  }
  fixLeafNodes();
  buildTrash();
  if (selectedItem != null) {
    ArrayList<TreeItem> parents=new ArrayList<TreeItem>();
    while (selectedItem != null) {
      parents.add(selectedItem);
      selectedItem=selectedItem.getParentItem();
    }
    Collections.reverse(parents);
    selectFromList(parents);
  }
 else {
    for (int i=0; i < getItemCount(); i++) {
      getItem(i).setState(true);
    }
  }
  WaitPopup.getInstance().setVisible(false);
}