Program: 137451
Project: 137451
Buggy source:
/** 
 * physical Delete all selected nodes, if the node has dependency, will popup a confirm dialog with lists of dependencies
 */
private void physicalDelete(){
  confirmForDQ=true;
  List<IRepositoryNode> folderNodeWhichChildHadDepend=null;
  for (int i=selectedNodes.size() - 1; i >= 0; i--) {
    if (selectedNodes.size() == 0) {
      break;
    }
    IRepositoryNode node=selectedNodes.get(i);
    IRepositoryNode parent=node.getParent();
    if (node.getType() == ENodeType.SIMPLE_FOLDER || node.getType() == ENodeType.SYSTEM_FOLDER) {
      List<IRepositoryNode> newLs=RepositoryNodeHelper.getRepositoryElementFromFolder(node,true);
      boolean haveSubNode=false;
      for (      IRepositoryNode subNode : newLs) {
        if (!hasDependencyClients(subNode)) {
          excuteSuperRun(subNode,node);
        }
 else {
          haveSubNode=true;
          if (folderNodeWhichChildHadDepend == null) {
            folderNodeWhichChildHadDepend=new ArrayList<IRepositoryNode>();
          }
          folderNodeWhichChildHadDepend.add(node);
        }
      }
      if (!haveSubNode) {
        excuteSuperRun(node,parent);
      }
    }
 else {
      if (!hasDependencyClients(node)) {
        excuteSuperRun(node,parent);
      }
    }
  }
  boolean forceDelete=false;
  if (nodeWithDependsMap.size() > 0) {
    forceDelete=DeleteModelElementConfirmDialog.showDialog(nodeWithDependsMap,DefaultMessagesImpl.getString("String_Node_Str"),true);
    if (forceDelete) {
      Iterator iter=nodeWithDependsMap.entrySet().iterator();
      while (iter.hasNext()) {
        Map.Entry<IRepositoryNode,List<ModelElement>> entry=(Map.Entry<IRepositoryNode,List<ModelElement>>)iter.next();
        IRepositoryNode node=entry.getKey();
        List<ModelElement> dependencies=entry.getValue();
        excuteSuperRun(node,node.getParent());
        physicalDeleteDependencies(dependencies);
      }
    }
  }
  nodeWithDependsMap.clear();
  if (folderNodeWhichChildHadDepend != null && folderNodeWhichChildHadDepend.size() > 0) {
    if (forceDelete) {
      for (      IRepositoryNode folder : folderNodeWhichChildHadDepend) {
        excuteSuperRun(folder,folder.getParent());
      }
    }
  }
  confirmForDQ=false;
}

Fixed version (ground truth):
/** 
 * physical Delete all selected nodes, if the node has dependency, will popup a confirm dialog with lists of dependencies
 */
private void physicalDelete(){
  List<IRepositoryNode> nodes=new ArrayList<IRepositoryNode>();
  nodes.addAll(selectedNodes);
  confirmForDQ=true;
  List<IRepositoryNode> folderNodeWhichChildHadDepend=null;
  Iterator<IRepositoryNode> iterator=nodes.iterator();
  while (iterator.hasNext()) {
    IRepositoryNode node=iterator.next();
    IRepositoryNode parent=node.getParent();
    if (node.getType() == ENodeType.SIMPLE_FOLDER || node.getType() == ENodeType.SYSTEM_FOLDER) {
      List<IRepositoryNode> newLs=RepositoryNodeHelper.getRepositoryElementFromFolder(node,true);
      boolean haveSubNode=false;
      for (      IRepositoryNode subNode : newLs) {
        if (!hasDependencyClients(subNode)) {
          excuteSuperRun(subNode,node);
        }
 else {
          haveSubNode=true;
          if (folderNodeWhichChildHadDepend == null) {
            folderNodeWhichChildHadDepend=new ArrayList<IRepositoryNode>();
          }
          if (!folderNodeWhichChildHadDepend.contains(node)) {
            folderNodeWhichChildHadDepend.add(node);
          }
        }
      }
      if (!haveSubNode) {
        excuteSuperRun(node,parent);
      }
    }
 else {
      if (!hasDependencyClients(node)) {
        excuteSuperRun(node,parent);
      }
    }
  }
  boolean forceDelete=false;
  if (nodeWithDependsMap.size() > 0) {
    forceDelete=DeleteModelElementConfirmDialog.showDialog(nodeWithDependsMap,DefaultMessagesImpl.getString("String_Node_Str"),true);
    if (forceDelete) {
      Iterator<Entry<IRepositoryNode,List<ModelElement>>> iter=nodeWithDependsMap.entrySet().iterator();
      while (iter.hasNext()) {
        Map.Entry<IRepositoryNode,List<ModelElement>> entry=iter.next();
        IRepositoryNode node=entry.getKey();
        List<ModelElement> dependencies=entry.getValue();
        excuteSuperRun(node,node.getParent());
        physicalDeleteDependencies(dependencies);
      }
    }
  }
  nodeWithDependsMap.clear();
  if (folderNodeWhichChildHadDepend != null && folderNodeWhichChildHadDepend.size() > 0) {
    if (forceDelete) {
      for (      IRepositoryNode folder : folderNodeWhichChildHadDepend) {
        excuteSuperRun(folder,folder.getParent());
      }
    }
  }
  confirmForDQ=false;
}