Program: 119842
Project: 119842
Buggy source:
/** 
 * amaumont Comment method "createLinks".
 */
public void createLinks(){
  removeAllLinks();
  getBackgroundRefresher().refreshBackground();
  ProgressDialog progressDialog=new ProgressDialog(getSource().getShell(),1000){
    private IProgressMonitor monitorWrap;
    @Override public void run(    IProgressMonitor monitor){
      TreeItem root=xmlViewer.getTree().getItem(0);
      if (getManager().getHl7Component().isHL7Output()) {
        if (getManager() instanceof HL7OutputManager) {
          List<HL7TreeNode> treeData=((HL7OutputManager)getManager()).getTreeData("String_Node_Str");
          createLoopLinks(treeData);
          getBackgroundRefresher().refreshBackground();
        }
      }
 else {
        List<TreeItem> allItems=TreeUtils.collectAllItems(root);
        monitorWrap=new EventLoopProgressMonitor(monitor);
        String taskName=Messages.getString("String_Node_Str");
        int totalWork=allItems.size();
        monitorWrap.beginTask(taskName,totalWork);
        for (int i=0; i < totalWork; i++) {
          if (monitorWrap.isCanceled()) {
            return;
          }
          TreeItem treeItem=allItems.get(i);
          HL7TreeNode node=(HL7TreeNode)treeItem.getData();
          if (node.getColumn() == null) {
            continue;
          }
          createLoopLinks(node.getColumn().getLabel(),treeItem,monitorWrap,i == totalWork - 1);
          monitorWrap.worked(1);
        }
        monitorWrap.done();
      }
    }
  }
;
  try {
    progressDialog.executeProcess();
  }
 catch (  InvocationTargetException e) {
    e.printStackTrace();
    ExceptionHandler.process(e);
  }
catch (  InterruptedException e) {
    ExceptionHandler.process(e);
  }
}

Fixed version (ground truth):
/** 
 * amaumont Comment method "createLinks".
 */
public void createLinks(){
  removeAllLinks();
  getBackgroundRefresher().refreshBackground();
  ProgressDialog progressDialog=new ProgressDialog(getSource().getShell(),1000){
    private IProgressMonitor monitorWrap;
    @Override public void run(    IProgressMonitor monitor){
      TreeItem root=xmlViewer.getTree().getItem(0);
      if (getManager().getHl7Component().isHL7Output()) {
        if (getManager() instanceof HL7OutputManager) {
          List<HL7TreeNode> mappableNodes=new ArrayList<HL7TreeNode>();
          IElementParameter param=getManager().getHl7Component().getElementParameterFromField(EParameterFieldType.PROPERTY_TYPE);
          String value=(String)param.getChildParameters().get(EParameterName.PROPERTY_TYPE.getName()).getValue();
          if (value.equals(EmfComponent.BUILTIN)) {
            List<HL7TreeNode> treeData=((HL7OutputManager)getManager()).getTreeData(((HL7OutputManager)getManager()).getCurrentSchema(false));
            for (            HL7TreeNode data : treeData) {
              if (data.isMain()) {
                if (data.hasChildren()) {
                  mappableNodes.addAll(data.getChildren());
                }
              }
 else {
                mappableNodes.add(data);
              }
            }
          }
 else {
            mappableNodes=((HL7OutputManager)getManager()).getTreeData("String_Node_Str");
          }
          createLoopLinks(mappableNodes);
          xmlViewer.refresh();
          getBackgroundRefresher().refreshBackground();
        }
      }
 else {
        List<TreeItem> allItems=TreeUtils.collectAllItems(root);
        monitorWrap=new EventLoopProgressMonitor(monitor);
        String taskName=Messages.getString("String_Node_Str");
        int totalWork=allItems.size();
        monitorWrap.beginTask(taskName,totalWork);
        for (int i=0; i < totalWork; i++) {
          if (monitorWrap.isCanceled()) {
            return;
          }
          TreeItem treeItem=allItems.get(i);
          HL7TreeNode node=(HL7TreeNode)treeItem.getData();
          if (node.getColumn() == null) {
            continue;
          }
          createLoopLinks(node.getColumn().getLabel(),treeItem,monitorWrap,i == totalWork - 1);
          monitorWrap.worked(1);
        }
        monitorWrap.done();
      }
    }
  }
;
  try {
    progressDialog.executeProcess();
  }
 catch (  InvocationTargetException e) {
    e.printStackTrace();
    ExceptionHandler.process(e);
  }
catch (  InterruptedException e) {
    ExceptionHandler.process(e);
  }
}