Program: 124097
Project: 124097
Buggy source:
/** 
 * DOC hcw Comment method "createItemList".
 * @param workArea
 */
private void createItemList(Composite workArea){
  Composite itemComposite=new Composite(workArea,SWT.NONE);
  GridLayoutFactory.swtDefaults().numColumns(2).applyTo(itemComposite);
  GridDataFactory.swtDefaults().align(SWT.FILL,SWT.FILL).grab(true,true).hint(500,300).applyTo(itemComposite);
  Label label=new Label(itemComposite,SWT.NONE);
  label.setText(Messages.getString("String_Node_Str"));
  GridDataFactory.swtDefaults().span(2,1).applyTo(label);
  createTreeViewer(itemComposite);
  createSelectionButton(itemComposite);
  exportItemsTreeViewer.refresh();
  viewer=exportItemsTreeViewer.getViewer();
  viewer.expandAll();
  viewer.collapseAll();
  viewer.expandToLevel(2);
  addTreeCheckedSelection();
  if (!selection.isEmpty()) {
    Set<RepositoryNode> newSelection=new HashSet<RepositoryNode>();
    for (    RepositoryNode currentNode : (List<RepositoryNode>)selection.toList()) {
      List<IRepositoryViewObject> objects=null;
      if (currentNode.getContentType() != null && currentNode.getObject() != null && currentNode.getObjectType() != ERepositoryObjectType.FOLDER) {
        try {
          objects=exportItemsTreeViewer.getAll(currentNode.getObjectType());
        }
 catch (        IllegalArgumentException e) {
          objects=new ArrayList<IRepositoryViewObject>();
        }
        for (        IRepositoryViewObject nodeToSelect : objects) {
          if (currentNode.getObject().getId().equals(nodeToSelect.getId())) {
            newSelection.add((RepositoryNode)nodeToSelect.getRepositoryNode());
          }
        }
      }
 else {
        newSelection.add(currentNode);
      }
    }
    repositoryNodes.addAll(newSelection);
    repositoryNodes.addAll(checkedNodes);
    Set<RepositoryNode> nodes=new HashSet<RepositoryNode>();
    for (    RepositoryNode node : repositoryNodes) {
      expandRoot(node);
      expandParent(viewer,node);
      checkElement(node,nodes);
    }
    ((CheckboxTreeViewer)viewer).setCheckedElements(nodes.toArray());
  }
}

Fixed version (ground truth):
/** 
 * DOC hcw Comment method "createItemList".
 * @param workArea
 */
private void createItemList(Composite workArea){
  Composite itemComposite=new Composite(workArea,SWT.NONE);
  GridLayoutFactory.swtDefaults().numColumns(2).applyTo(itemComposite);
  GridDataFactory.swtDefaults().align(SWT.FILL,SWT.FILL).grab(true,true).hint(500,300).applyTo(itemComposite);
  Label label=new Label(itemComposite,SWT.NONE);
  label.setText(Messages.getString("String_Node_Str"));
  GridDataFactory.swtDefaults().span(2,1).applyTo(label);
  createTreeViewer(itemComposite);
  createSelectionButton(itemComposite);
  exportItemsTreeViewer.refresh();
  viewer=exportItemsTreeViewer.getViewer();
  viewer.expandAll();
  viewer.collapseAll();
  viewer.expandToLevel(2);
  addTreeCheckedSelection();
  if (!selection.isEmpty()) {
    Set<RepositoryNode> newSelection=new HashSet<RepositoryNode>();
    for (    RepositoryNode currentNode : (List<RepositoryNode>)selection.toList()) {
      newSelection.add(currentNode);
    }
    repositoryNodes.addAll(newSelection);
    repositoryNodes.addAll(checkedNodes);
    Set<RepositoryNode> nodes=new HashSet<RepositoryNode>();
    for (    RepositoryNode node : repositoryNodes) {
      expandRoot(node);
      expandParent(viewer,node);
      checkElement(node,nodes);
    }
    ((CheckboxTreeViewer)viewer).setCheckedElements(nodes.toArray());
  }
}